Fix update scripts: pixelfed storage backup, github-runner full config backup, forgejo-runner version check

This commit is contained in:
CanbiZ (MickLesk)
2026-03-27 14:41:37 +01:00
parent b889281340
commit 61d73907ec
4 changed files with 18 additions and 5 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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"