fixes
This commit is contained in:
parent
729e213d46
commit
6eb3b84073
@ -25,22 +25,57 @@ function update_script() {
|
|||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -f /etc/systemd/system/esphomeDashboard.service ]]; then
|
if [[ ! -f /etc/systemd/system/esphomeDashboard.service ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
msg_info "Stopping ESPHome"
|
|
||||||
|
msg_info "Stopping ${APP}"
|
||||||
systemctl stop esphomeDashboard
|
systemctl stop esphomeDashboard
|
||||||
msg_ok "Stopped ESPHome"
|
msg_ok "Stopped ${APP}"
|
||||||
|
|
||||||
|
VENV_PATH="/opt/esphome/.venv"
|
||||||
|
ESPHOME_BIN="${VENV_PATH}/bin/esphome"
|
||||||
|
export PYTHON_VERSION="3.12"
|
||||||
|
|
||||||
|
if [[ ! -d "$VENV_PATH" || ! -x "$ESPHOME_BIN" ]]; then
|
||||||
|
PYTHON_VERSION="3.12" setup_uv
|
||||||
|
msg_info "Migrating to uv/venv"
|
||||||
|
rm -rf "$VENV_PATH"
|
||||||
|
mkdir -p /opt/esphome
|
||||||
|
cd /opt/esphome
|
||||||
|
$STD uv venv "$VENV_PATH"
|
||||||
|
$STD "$VENV_PATH/bin/python" -m ensurepip --upgrade
|
||||||
|
$STD "$VENV_PATH/bin/python" -m pip install --upgrade pip
|
||||||
|
$STD "$VENV_PATH/bin/python" -m pip install esphome tornado esptool
|
||||||
|
msg_ok "Migrated to uv/venv"
|
||||||
|
else
|
||||||
msg_info "Updating ESPHome"
|
msg_info "Updating ESPHome"
|
||||||
if [[ -d /srv/esphome ]]; then
|
PYTHON_VERSION="3.12" setup_uv
|
||||||
$STD source /srv/esphome/bin/activate
|
$STD "$VENV_PATH/bin/python" -m pip install --upgrade esphome tornado esptool
|
||||||
fi
|
|
||||||
$STD pip3 install -U esphome
|
|
||||||
msg_ok "Updated ESPHome"
|
msg_ok "Updated ESPHome"
|
||||||
|
fi
|
||||||
|
SERVICE_FILE="/etc/systemd/system/esphomeDashboard.service"
|
||||||
|
if ! grep -q "${VENV_PATH}/bin/esphome" "$SERVICE_FILE"; then
|
||||||
|
msg_info "Updating systemd service"
|
||||||
|
cat <<EOF >"$SERVICE_FILE"
|
||||||
|
[Unit]
|
||||||
|
Description=ESPHome Dashboard
|
||||||
|
After=network.target
|
||||||
|
|
||||||
msg_info "Starting ESPHome"
|
[Service]
|
||||||
|
ExecStart=${VENV_PATH}/bin/esphome dashboard /root/config/
|
||||||
|
Restart=always
|
||||||
|
User=root
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
$STD systemctl daemon-reload
|
||||||
|
msg_ok "Updated systemd service"
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_info "Starting ${APP}"
|
||||||
systemctl start esphomeDashboard
|
systemctl start esphomeDashboard
|
||||||
msg_ok "Started ESPHome"
|
msg_ok "Started ${APP}"
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user