From 61d73907ecabe205e0dbfcdb4f20b76e86f2d951 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Fri, 27 Mar 2026 14:41:37 +0100 Subject: [PATCH] Fix update scripts: pixelfed storage backup, github-runner full config backup, forgejo-runner version check --- ct/forgejo-runner.sh | 8 +++++++- ct/github-runner.sh | 10 ++++++---- ct/pixelfed.sh | 4 ++++ install/forgejo-runner-install.sh | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ct/forgejo-runner.sh b/ct/forgejo-runner.sh index 8cacea85..652085ff 100644 --- a/ct/forgejo-runner.sh +++ b/ct/forgejo-runner.sh @@ -33,14 +33,20 @@ function update_script() { exit 1 fi + RELEASE=$(curl -fsSL https://data.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//') + if [[ "${RELEASE}" == "$(cat ~/.forgejo-runner 2>/dev/null)" ]]; then + msg_ok "No update required. ${APP} is already at v${RELEASE}" + exit + fi + msg_info "Stopping Services" systemctl stop forgejo-runner msg_ok "Stopped Services" - RELEASE=$(curl -fsSL https://data.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//') msg_info "Updating Forgejo Runner to v${RELEASE}" curl -fsSL "https://code.forgejo.org/forgejo/runner/releases/download/v${RELEASE}/forgejo-runner-${RELEASE}-linux-amd64" -o /usr/local/bin/forgejo-runner chmod +x /usr/local/bin/forgejo-runner + echo "${RELEASE}" >~/.forgejo-runner msg_ok "Updated Forgejo Runner" msg_info "Starting Services" diff --git a/ct/github-runner.sh b/ct/github-runner.sh index 61556ed2..fbfb7d9a 100644 --- a/ct/github-runner.sh +++ b/ct/github-runner.sh @@ -40,15 +40,17 @@ function update_script() { msg_info "Backing up runner configuration" BACKUP_DIR="/opt/actions-runner.backup" mkdir -p "$BACKUP_DIR" - [[ -f /opt/actions-runner/.runner ]] && cp -a /opt/actions-runner/.runner "$BACKUP_DIR/" - [[ -f /opt/actions-runner/.credentials ]] && cp -a /opt/actions-runner/.credentials "$BACKUP_DIR/" + for f in .runner .credentials .credentials_rsaparams .env .path; do + [[ -f /opt/actions-runner/$f ]] && cp -a /opt/actions-runner/$f "$BACKUP_DIR/" + done msg_ok "Backed up configuration" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "actions-runner" "actions/runner" "prebuild" "latest" "/opt/actions-runner" "actions-runner-linux-x64-*.tar.gz" msg_info "Restoring runner configuration" - [[ -f "$BACKUP_DIR/.runner" ]] && cp -a "$BACKUP_DIR/.runner" /opt/actions-runner/ - [[ -f "$BACKUP_DIR/.credentials" ]] && cp -a "$BACKUP_DIR/.credentials" /opt/actions-runner/ + for f in .runner .credentials .credentials_rsaparams .env .path; do + [[ -f "$BACKUP_DIR/$f" ]] && cp -a "$BACKUP_DIR/$f" /opt/actions-runner/ + done rm -rf "$BACKUP_DIR" msg_ok "Restored configuration" diff --git a/ct/pixelfed.sh b/ct/pixelfed.sh index 85de1079..9f14ab21 100644 --- a/ct/pixelfed.sh +++ b/ct/pixelfed.sh @@ -37,13 +37,16 @@ function update_script() { msg_info "Backing up Configuration" cp /opt/pixelfed/.env /opt/pixelfed.env.bak + cp -r /opt/pixelfed/storage /opt/pixelfed-storage.bak msg_ok "Configuration backed up" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "pixelfed" "pixelfed/pixelfed" "tarball" "latest" "/opt/pixelfed" msg_info "Restoring Configuration" cp /opt/pixelfed.env.bak /opt/pixelfed/.env + cp -r /opt/pixelfed-storage.bak /opt/pixelfed/storage rm -f /opt/pixelfed.env.bak + rm -rf /opt/pixelfed-storage.bak msg_ok "Configuration restored" msg_info "Updating Pixelfed" @@ -52,6 +55,7 @@ function update_script() { chmod -R 775 /opt/pixelfed/storage /opt/pixelfed/bootstrap/cache export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-dev --no-ansi --no-interaction --optimize-autoloader + $STD sudo -u pixelfed php artisan storage:link $STD sudo -u pixelfed php artisan migrate --force $STD sudo -u pixelfed php artisan route:cache $STD sudo -u pixelfed php artisan view:cache diff --git a/install/forgejo-runner-install.sh b/install/forgejo-runner-install.sh index 3bbcdc45..97968e75 100644 --- a/install/forgejo-runner-install.sh +++ b/install/forgejo-runner-install.sh @@ -43,6 +43,7 @@ msg_info "Installing Forgejo Runner" RUNNER_VERSION=$(curl -fsSL https://data.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | jq -r .name | sed 's/^v//') curl -fsSL "https://code.forgejo.org/forgejo/runner/releases/download/v${RUNNER_VERSION}/forgejo-runner-${RUNNER_VERSION}-linux-amd64" -o /usr/local/bin/forgejo-runner chmod +x /usr/local/bin/forgejo-runner +echo "${RUNNER_VERSION}" >~/.forgejo-runner msg_ok "Installed Forgejo Runner" msg_info "Registering Forgejo Runner"