Skip to content

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 bash
2set -Eeuo pipefail
3[[ $EUID -ne 0 ]] || { echo 'Run ./update.sh as your normal ArchForge user, NOT with sudo.' >&2; exit 1; }
4ROOT=$(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; }
7BRANCH=$(git -C "$ROOT" branch --show-current)
8[[ -n "$BRANCH" ]] || { echo 'Detached HEAD. Check out the desired release branch first.' >&2;exit 1; }
9echo "Fetching updates for branch $BRANCH..."
10git -C "$ROOT" pull --ff-only
11read -rp 'Deploy this version? Type DEPLOY: ' ANS
12[[ "$ANS" == DEPLOY ]] || exit 0
13sudo bash "$ROOT/scripts/deploy.sh" "$ROOT"