mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-04-05 08:54:03 -04:00
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.
This commit is contained in:
@@ -88,6 +88,15 @@ function update() {
|
|||||||
rm -f /tmp/cronmaster.env.bak
|
rm -f /tmp/cronmaster.env.bak
|
||||||
msg_ok "Restored configuration"
|
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"
|
msg_info "Starting service"
|
||||||
systemctl start cronmaster
|
systemctl start cronmaster
|
||||||
msg_ok "Started service"
|
msg_ok "Started service"
|
||||||
@@ -146,12 +155,11 @@ EOF
|
|||||||
|
|
||||||
# Create update script
|
# Create update script
|
||||||
msg_info "Creating update script"
|
msg_info "Creating update script"
|
||||||
ensure_usr_local_bin_persist
|
cat <<'UPDATEEOF' >/usr/local/bin/update_cronmaster
|
||||||
cat <<EOF >/usr/local/bin/update_cronmaster
|
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# CronMaster Update Script
|
# CronMaster Update Script
|
||||||
type=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/cronmaster.sh)"
|
CRONMASTER_ACTION=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/tools/addon/cronmaster.sh)"
|
||||||
EOF
|
UPDATEEOF
|
||||||
chmod +x /usr/local/bin/update_cronmaster
|
chmod +x /usr/local/bin/update_cronmaster
|
||||||
msg_ok "Created update script (/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
|
ensure_usr_local_bin_persist
|
||||||
get_lxc_ip
|
get_lxc_ip
|
||||||
|
|
||||||
# Handle type=update (called from update script)
|
# Handle CRONMASTER_ACTION=update (called from update script)
|
||||||
if [[ "${type:-}" == "update" ]]; then
|
if [[ "${CRONMASTER_ACTION:-}" == "update" ]]; then
|
||||||
if [[ -d "$INSTALL_PATH" ]]; then
|
if [[ -d "$INSTALL_PATH" ]]; then
|
||||||
update
|
update
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user