-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·38 lines (29 loc) · 792 Bytes
/
Copy pathbootstrap
File metadata and controls
executable file
·38 lines (29 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
set -euo pipefail
log() {
printf '==> %s\n' "$*"
}
die() {
printf 'ERROR: %s\n' "$*" >&2
exit 1
}
require_cmd() {
command -v "$1" >/dev/null 2>&1 || die "Missing required command: $1"
}
REPO_URL="${NIRILAND_REPO_URL:-https://github.com/Furyfree/niriland.git}"
TARGET_DIR="${NIRILAND_DIR:-$HOME/.local/share/niriland}"
require_cmd git
if [[ -d "$TARGET_DIR/.git" ]]; then
log "Updating repo in $TARGET_DIR"
git -C "$TARGET_DIR" pull --ff-only
else
log "Cloning repo to $TARGET_DIR"
mkdir -p "$(dirname "$TARGET_DIR")"
git clone "$REPO_URL" "$TARGET_DIR"
fi
INSTALL_SCRIPT="$TARGET_DIR/install"
if [[ ! -x "$INSTALL_SCRIPT" ]]; then
die "Install script not found or not executable: $INSTALL_SCRIPT"
fi
log "Bootstrapping"
bash "$INSTALL_SCRIPT"