From 4f0ef8b001c89088398cb0005182e379334ed9bf Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:35:47 +0100 Subject: [PATCH] Add update script and use CRONMASTER_ACTION Create /usr/local/bin/update_cronmaster during install and inside update() (using a single-quoted heredoc to avoid variable expansion) and make it executable. The generated updater now exports CRONMASTER_ACTION=update when invoking the fetched cronmaster.sh, and the main script checks CRONMASTER_ACTION instead of type. Also adjust the repository fetch path and remove a duplicate ensure_usr_local_bin_persist call. --- tools/addon/cronmaster.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/addon/cronmaster.sh b/tools/addon/cronmaster.sh index b8ae5502e..887558f86 100644 --- a/tools/addon/cronmaster.sh +++ b/tools/addon/cronmaster.sh @@ -88,6 +88,15 @@ function update() { rm -f /tmp/cronmaster.env.bak msg_ok "Restored configuration" + msg_info "Updating update script" + cat <<'UPDATEEOF' >/usr/local/bin/update_cronmaster +#!/usr/bin/env bash +# CronMaster Update Script +CRONMASTER_ACTION=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/tools/addon/cronmaster.sh)" +UPDATEEOF + chmod +x /usr/local/bin/update_cronmaster + msg_ok "Updated update script" + msg_info "Starting service" systemctl start cronmaster msg_ok "Started service" @@ -146,12 +155,11 @@ EOF # Create update script msg_info "Creating update script" - ensure_usr_local_bin_persist - cat </usr/local/bin/update_cronmaster + cat <<'UPDATEEOF' >/usr/local/bin/update_cronmaster #!/usr/bin/env bash # CronMaster Update Script -type=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/cronmaster.sh)" -EOF +CRONMASTER_ACTION=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/tools/addon/cronmaster.sh)" +UPDATEEOF chmod +x /usr/local/bin/update_cronmaster msg_ok "Created update script (/usr/local/bin/update_cronmaster)" @@ -177,8 +185,8 @@ header_info ensure_usr_local_bin_persist get_lxc_ip -# Handle type=update (called from update script) -if [[ "${type:-}" == "update" ]]; then +# Handle CRONMASTER_ACTION=update (called from update script) +if [[ "${CRONMASTER_ACTION:-}" == "update" ]]; then if [[ -d "$INSTALL_PATH" ]]; then update else