From 8d6675ffb78c3d09959489e2bc6424e59dddea1e Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Wed, 4 Mar 2026 07:42:40 +0100 Subject: [PATCH] fix(migration): atomic /usr/bin/update replacement to prevent syntax errors All 8 migration scripts (runtipi, dockge, dokploy, coolify, komodo, alpine-komodo, overseerr, jellyseerr) overwrote /usr/bin/update in-place while the parent shell still had the file open for reading. Since the new content is longer than the original, bash would read leftover bytes after the child process exited, causing garbled output or syntax errors like: /usr/bin/update: line 2: syntax error near unexpected token ) Fix: - Write to a temp file first, then mv over /usr/bin/update (atomic inode replacement so parent shell sees EOF on old fd) - Remove unnecessary shebang from heredoc content in overseerr/jellyseerr (consistent with all other update scripts and install.func) --- ct/alpine-komodo.sh | 4 +++- ct/coolify.sh | 4 +++- ct/dockge.sh | 4 +++- ct/dokploy.sh | 4 +++- ct/jellyseerr.sh | 7 ++++--- ct/komodo.sh | 4 +++- ct/overseerr.sh | 5 +++-- ct/runtipi.sh | 4 +++- 8 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ct/alpine-komodo.sh b/ct/alpine-komodo.sh index 44a459c7b..e18de110e 100644 --- a/ct/alpine-komodo.sh +++ b/ct/alpine-komodo.sh @@ -48,9 +48,11 @@ function update_script() { fi msg_info "Migrating update function" - cat <<'MIGRATION_EOF' >/usr/bin/update + TMP_UPDATE=$(mktemp) + cat <<'MIGRATION_EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/komodo.sh)" MIGRATION_EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update ln -sf /usr/bin/update /usr/bin/update_komodo 2>/dev/null || true diff --git a/ct/coolify.sh b/ct/coolify.sh index 44c7ff2ba..465ea8fa3 100644 --- a/ct/coolify.sh +++ b/ct/coolify.sh @@ -46,9 +46,11 @@ function update_script() { fi msg_info "Migrating update function" - cat <<'MIGRATION_EOF' >/usr/bin/update + TMP_UPDATE=$(mktemp) + cat <<'MIGRATION_EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/coolify.sh)" MIGRATION_EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update ln -sf /usr/bin/update /usr/bin/update_coolify 2>/dev/null || true diff --git a/ct/dockge.sh b/ct/dockge.sh index 6612e165c..9dcc16f43 100644 --- a/ct/dockge.sh +++ b/ct/dockge.sh @@ -48,9 +48,11 @@ function update_script() { fi msg_info "Migrating update function" - cat <<'MIGRATION_EOF' >/usr/bin/update + TMP_UPDATE=$(mktemp) + cat <<'MIGRATION_EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/dockge.sh)" MIGRATION_EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update ln -sf /usr/bin/update /usr/bin/update_dockge 2>/dev/null || true diff --git a/ct/dokploy.sh b/ct/dokploy.sh index 55a2a9be6..2545f292e 100644 --- a/ct/dokploy.sh +++ b/ct/dokploy.sh @@ -46,9 +46,11 @@ function update_script() { fi msg_info "Migrating update function" - cat <<'MIGRATION_EOF' >/usr/bin/update + TMP_UPDATE=$(mktemp) + cat <<'MIGRATION_EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/dokploy.sh)" MIGRATION_EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update ln -sf /usr/bin/update /usr/bin/update_dokploy 2>/dev/null || true diff --git a/ct/jellyseerr.sh b/ct/jellyseerr.sh index 799aa3593..ca0acd02e 100644 --- a/ct/jellyseerr.sh +++ b/ct/jellyseerr.sh @@ -45,14 +45,15 @@ function update_script() { fi msg_info "Switching update script to Seerr" - cat <<'EOF' >/usr/bin/update -#!/usr/bin/env bash + TMP_UPDATE=$(mktemp) + cat <<'EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/seerr.sh)" EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update msg_ok "Switched update script to Seerr" msg_warn "Please type 'update' again to complete the migration" - exit + exit 0 fi msg_info "Updating Jellyseerr" diff --git a/ct/komodo.sh b/ct/komodo.sh index a6957b4d4..545862b41 100644 --- a/ct/komodo.sh +++ b/ct/komodo.sh @@ -52,9 +52,11 @@ function update_script() { fi msg_info "Migrating update function" - cat <<'MIGRATION_EOF' >/usr/bin/update + TMP_UPDATE=$(mktemp) + cat <<'MIGRATION_EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/komodo.sh)" MIGRATION_EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update ln -sf /usr/bin/update /usr/bin/update_komodo 2>/dev/null || true diff --git a/ct/overseerr.sh b/ct/overseerr.sh index 53f0a5dad..63615c65f 100644 --- a/ct/overseerr.sh +++ b/ct/overseerr.sh @@ -44,10 +44,11 @@ function update_script() { fi msg_info "Switching update script to Seerr" - cat <<'EOF' >/usr/bin/update -#!/usr/bin/env bash + TMP_UPDATE=$(mktemp) + cat <<'EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/seerr.sh)" EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update msg_ok "Switched update script to Seerr" msg_warn "Please type 'update' again to complete the migration" diff --git a/ct/runtipi.sh b/ct/runtipi.sh index 4b62015a4..38dcc2380 100644 --- a/ct/runtipi.sh +++ b/ct/runtipi.sh @@ -46,9 +46,11 @@ function update_script() { fi msg_info "Migrating update function" - cat <<'MIGRATION_EOF' >/usr/bin/update + TMP_UPDATE=$(mktemp) + cat <<'MIGRATION_EOF' >"$TMP_UPDATE" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/runtipi.sh)" MIGRATION_EOF + mv "$TMP_UPDATE" /usr/bin/update chmod +x /usr/bin/update ln -sf /usr/bin/update /usr/bin/update_runtipi 2>/dev/null || true