Update pyenv2.sh

This commit is contained in:
tteckster 2022-12-07 16:02:05 -05:00 committed by GitHub
parent 532da20188
commit 124e0e191b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 7 deletions

View File

@ -27,6 +27,7 @@ cd /srv/homeassistant
python3 -m venv .
source bin/activate
python3 -m pip install wheel &>/dev/null
pip3 install --upgrade pip &>/dev/null
pip3 install psycopg2-binary &>/dev/null
pip3 install --pre homeassistant &>/dev/null
systemctl enable homeassistant &>/dev/null
@ -40,19 +41,35 @@ if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]
ESP="Y"
fi
if [[ $ESP == "Y" ]]; then
echo "Installing ESPHome"
echo "Installing ESPHome Beta"
mkdir /srv/esphome
cd /srv/esphome
python3 -m venv .
source bin/activate
python3 -m pip install wheel &>/dev/null
pip3 install --upgrade pip &>/dev/null
pip3 install --pre esphome &>/dev/null
cat <<EOF >/etc/systemd/system/esphomeDashboard.service
cat <<EOF >/srv/esphome/start.sh
#!/bin/bash
source /srv/esphome/bin/activate
esphome dashboard /srv/esphome/
EOF
chmod +x start.sh
cat <<EOF >/etc/systemd/system/esphomedashboard.service
[Unit]
Description=ESPHome Dashboard
Description=ESPHome Dashboard Service
After=network.target
[Service]
ExecStart=/root/.pyenv/versions/3.10.8/bin/esphome /root/.pyenv/versions/3.10.8/lib/python3.10/site-packages/esphome_dashboard dashboard
Restart=always
Type=simple
User=root
WorkingDirectory=/srv/esphome
ExecStart=/srv/esphome/start.sh
RestartSec=30
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now esphomeDashboard &>/dev/null
echo "Installed ESPHome"
systemctl enable --now esphomedashboard &>/dev/null
echo "Installed ESPHome Beta"
echo -e " Go to $(hostname -I | awk '{print $1}'):6052"
fi