[feat]: migrate all update_scripts to new version helper (gh) (#7262)

* first migrations

* finalize

* add fix kometa inside function
This commit is contained in:
CanbiZ 2025-08-29 12:27:24 +02:00 committed by GitHub
parent 54b59e24ca
commit 9305a4ca85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
145 changed files with 1041 additions and 1656 deletions

View file

@ -28,21 +28,7 @@ function update_script() {
exit
fi
if [[ -f ~/.zigbee2mqtt ]]; then
CURRENT="$(cat ~/.zigbee2mqtt)"
elif [[ -f /opt/${APP}_version.txt ]]; then
CURRENT="$(cat /opt/${APP}_version.txt)"
rm -f /opt/${APP}_version.txt
else
CURRENT=""
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/Koenkk/zigbee2mqtt/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "$RELEASE" != "$CURRENT" ]]; then
if ! command -v jq &>/dev/null; then
$STD apt-get update
$STD apt-get install -y jq
fi
if check_for_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt"; then
NODE_VERSION=24 NODE_MODULE="pnpm@$(curl -fsSL https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
msg_info "Stopping Service"
@ -58,7 +44,7 @@ function update_script() {
fetch_and_deploy_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt" "tarball" "latest" "/opt/zigbee2mqtt"
msg_info "Updating ${APP} to v${RELEASE}"
msg_info "Updating ${APP}"
rm -rf /opt/zigbee2mqtt/data
mv /opt/z2m_backup/data /opt/zigbee2mqtt
cd /opt/zigbee2mqtt
@ -73,8 +59,7 @@ function update_script() {
msg_info "Cleaning up"
rm -rf /opt/z2m_backup
msg_ok "Cleaned up"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}."
msg_ok "Updated Successfully"
fi
exit
}