pyenv2.sh 2.5 KB

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