install features

This commit is contained in:
Brad Stein 2025-07-04 18:24:48 -05:00
parent 394b842e49
commit 6b1a7d1963

View File

@ -3,6 +3,18 @@
set -euo pipefail
ORIG_USER=${SUDO_USER:-$(id -un)}
REF=${LESAVKA_REF:-master} # fallback
while [[ $# -gt 0 ]]; do
case $1 in
-r|--ref) REF="$2"; shift 2 ;;
-h|--help)
echo "Usage: $0 [--ref <branch|commit>]"; exit 0 ;;
*) echo "Unknown option: $1"; exit 1 ;;
esac
done
echo "==> Using git ref: $REF"
echo "==> 1a. Base packages"
sudo pacman -Syq --needed --noconfirm git \
rustup \
@ -86,6 +98,12 @@ if [[ -d $SRC_DIR/.git ]]; then
sudo -u "$ORIG_USER" git -C "$SRC_DIR" pull --ff-only
else
sudo -u "$ORIG_USER" git clone "$REPO_URL" "$SRC_DIR"
fip
if sudo -u "$ORIG_USER" git -C "$SRC_DIR" rev-parse --verify --quiet "origin/$REF" >/dev/null; then
sudo -u "$ORIG_USER" git -C "$SRC_DIR" checkout -B "$REF" "origin/$REF"
else
sudo -u "$ORIG_USER" git -C "$SRC_DIR" checkout --force "$REF"
fi
echo "==> 4b. Source build"