pyenv2.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/usr/bin/env bash
  2. if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Install on Proxmox "; exit; fi
  3. set -e
  4. DIR=/root/.pyenv/versions/3.10.8
  5. if [ -d "$DIR" ]; then
  6. echo "Python 3.10.8 is already installed, moving on..."
  7. else
  8. echo "Installing Python 3.10.8"
  9. pyenv install 3.10.8 &>/dev/null
  10. pyenv global 3.10.8
  11. echo "Installed Python 3.10.8"
  12. fi
  13. read -r -p "Would you like to install Home Assistant Beta? <y/N> " prompt
  14. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  15. HA="Y"
  16. fi
  17. if [[ $HA == "Y" ]]; then
  18. echo "Installing Home Assistant Beta"
  19. cat <<EOF >/etc/systemd/system/homeassistant.service
  20. [Unit]
  21. Description=Home Assistant
  22. After=network-online.target
  23. [Service]
  24. Type=simple
  25. WorkingDirectory=/root/.homeassistant
  26. ExecStart=/srv/homeassistant/bin/hass -c "/root/.homeassistant"
  27. RestartForceExitStatus=100
  28. [Install]
  29. WantedBy=multi-user.target
  30. EOF
  31. mkdir /srv/homeassistant
  32. cd /srv/homeassistant
  33. python3 -m venv .
  34. source bin/activate
  35. python3 -m pip install wheel &>/dev/null
  36. pip3 install --upgrade pip &>/dev/null
  37. pip3 install psycopg2-binary &>/dev/null
  38. pip3 install --pre homeassistant &>/dev/null
  39. systemctl enable homeassistant &>/dev/null
  40. echo "Installed Home Assistant Beta"
  41. echo -e " Go to $(hostname -I | awk '{print $1}'):8123"
  42. hass
  43. fi
  44. read -r -p "Would you like to install ESPHome Beta? <y/N> " prompt
  45. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  46. ESP="Y"
  47. fi
  48. if [[ $ESP == "Y" ]]; then
  49. echo "Installing ESPHome Beta"
  50. mkdir /srv/esphome
  51. cd /srv/esphome
  52. python3 -m venv .
  53. source bin/activate
  54. python3 -m pip install wheel &>/dev/null
  55. pip3 install --upgrade pip &>/dev/null
  56. pip3 install --pre esphome &>/dev/null
  57. cat <<EOF >/srv/esphome/start.sh
  58. #!/bin/bash
  59. source /srv/esphome/bin/activate
  60. esphome dashboard /srv/esphome/
  61. EOF
  62. chmod +x start.sh
  63. cat <<EOF >/etc/systemd/system/esphomedashboard.service
  64. [Unit]
  65. Description=ESPHome Dashboard Service
  66. After=network.target
  67. [Service]
  68. Type=simple
  69. User=root
  70. WorkingDirectory=/srv/esphome
  71. ExecStart=/srv/esphome/start.sh
  72. RestartSec=30
  73. Restart=on-failure
  74. [Install]
  75. WantedBy=multi-user.target
  76. EOF
  77. systemctl enable --now esphomedashboard &>/dev/null
  78. echo "Installed ESPHome Beta"
  79. echo -e " Go to $(hostname -I | awk '{print $1}'):6052"
  80. fi
  81. read -r -p "Would you like to install Matter-Server? <y/N> " prompt
  82. if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
  83. MTR="Y"
  84. fi
  85. if [[ $MTR == "Y" ]]; then
  86. echo "Installing Matter Server"
  87. apt-get install -y \
  88. libcairo2-dev \
  89. libjpeg62-turbo-dev \
  90. libgirepository1.0-dev \
  91. libpango1.0-dev \
  92. libgif-dev \
  93. g++ &>/dev/null
  94. python3 -m pip install wheel
  95. pip3 install --upgrade pip
  96. pip install python-matter-server[server]
  97. echo "Installed Matter Server"
  98. echo -e "Start server > python -m matter_server.server"
  99. fi
  100. echo -e "\nFinished\n"