Update pyenv2.sh
This commit is contained in:
parent
532da20188
commit
124e0e191b
1 changed files with 24 additions and 7 deletions
|
@ -27,6 +27,7 @@ cd /srv/homeassistant
|
||||||
python3 -m venv .
|
python3 -m venv .
|
||||||
source bin/activate
|
source bin/activate
|
||||||
python3 -m pip install wheel &>/dev/null
|
python3 -m pip install wheel &>/dev/null
|
||||||
|
pip3 install --upgrade pip &>/dev/null
|
||||||
pip3 install psycopg2-binary &>/dev/null
|
pip3 install psycopg2-binary &>/dev/null
|
||||||
pip3 install --pre homeassistant &>/dev/null
|
pip3 install --pre homeassistant &>/dev/null
|
||||||
systemctl enable homeassistant &>/dev/null
|
systemctl enable homeassistant &>/dev/null
|
||||||
|
@ -40,19 +41,35 @@ if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]
|
||||||
ESP="Y"
|
ESP="Y"
|
||||||
fi
|
fi
|
||||||
if [[ $ESP == "Y" ]]; then
|
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
|
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]
|
[Unit]
|
||||||
Description=ESPHome Dashboard
|
Description=ESPHome Dashboard Service
|
||||||
After=network.target
|
After=network.target
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/root/.pyenv/versions/3.10.8/bin/esphome /root/.pyenv/versions/3.10.8/lib/python3.10/site-packages/esphome_dashboard dashboard
|
Type=simple
|
||||||
Restart=always
|
|
||||||
User=root
|
User=root
|
||||||
|
WorkingDirectory=/srv/esphome
|
||||||
|
ExecStart=/srv/esphome/start.sh
|
||||||
|
RestartSec=30
|
||||||
|
Restart=on-failure
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable --now esphomeDashboard &>/dev/null
|
systemctl enable --now esphomedashboard &>/dev/null
|
||||||
echo "Installed ESPHome"
|
echo "Installed ESPHome Beta"
|
||||||
|
echo -e " Go to $(hostname -I | awk '{print $1}'):6052"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue