Skip to content

Repository files, collaboration, releases and project activity.

ARCHFORGE HISTORY

Blame · scripts/update.sh

Branch main · the Commit author is not necessarily a verified ArchForge account.

e59b7f7cc6archadmin2026-10-111 #!/usr/bin/env bash
e59b7f7cc6archadmin2026-10-112 set -Eeuo pipefail
2109dd33b8archadmin2026-10-123 [[ $EUID -ne 0 ]] || { echo 'Run ./update.sh as your normal ArchForge user, NOT with sudo.' >&2; exit 1; }
e59b7f7cc6archadmin2026-10-114 ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
2109dd33b8archadmin2026-10-125 [[ -d "$ROOT/.git" ]] || { echo 'Updates require your original ArchForge checkout.' >&2; exit 1; }
e59b7f7cc6archadmin2026-10-116 [[ -z "$(git -C "$ROOT" status --porcelain)" ]] || { echo 'Uncommitted changes detected. Commit or stash before updating.' >&2;exit 1; }
e59b7f7cc6archadmin2026-10-117 BRANCH=$(git -C "$ROOT" branch --show-current)
e59b7f7cc6archadmin2026-10-118 [[ -n "$BRANCH" ]] || { echo 'Detached HEAD. Check out the desired release branch first.' >&2;exit 1; }
e59b7f7cc6archadmin2026-10-119 echo "Fetching updates for branch $BRANCH..."
e59b7f7cc6archadmin2026-10-1110 git -C "$ROOT" pull --ff-only
e59b7f7cc6archadmin2026-10-1111 read -rp 'Deploy this version? Type DEPLOY: ' ANS
e59b7f7cc6archadmin2026-10-1112 [[ "$ANS" == DEPLOY ]] || exit 0
e59b7f7cc6archadmin2026-10-1113 sudo bash "$ROOT/scripts/deploy.sh" "$ROOT"