Repository files, collaboration, releases and project activity.
archforge-external-status / scripts/update.shmain
▤ scripts/update.sh796 bytes
14 lines · Select a line number for a permalink
1
#!/usr/bin/env bash2
set -Eeuo pipefail3
[[ $EUID -ne 0 ]] || { echo 'Run ./update.sh as your normal ArchForge user, NOT with sudo.' >&2; exit 1; }4
ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)5
[[ -d "$ROOT/.git" ]] || { echo 'Updates require your original ArchForge checkout.' >&2; exit 1; }6
[[ -z "$(git -C "$ROOT" status --porcelain)" ]] || { echo 'Uncommitted changes detected. Commit or stash before updating.' >&2;exit 1; }7
BRANCH=$(git -C "$ROOT" branch --show-current)8
[[ -n "$BRANCH" ]] || { echo 'Detached HEAD. Check out the desired release branch first.' >&2;exit 1; }9
echo "Fetching updates for branch $BRANCH..."10
git -C "$ROOT" pull --ff-only11
read -rp 'Deploy this version? Type DEPLOY: ' ANS12
[[ "$ANS" == DEPLOY ]] || exit 013
sudo bash "$ROOT/scripts/deploy.sh" "$ROOT"