-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·70 lines (62 loc) · 1.7 KB
/
install
File metadata and controls
executable file
·70 lines (62 loc) · 1.7 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
set -euo pipefail
DOTFILES="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
dry_run=""
[[ "${1:-}" == "--dry" ]] && dry_run="--dry"
if [[ -z "$dry_run" ]]; then
echo "This will install packages and deploy configs."
read -rp "Continue? [y/N] " answer
if [[ ! "$answer" =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 0
fi
fi
echo "=== Environment ==="
current_env=""
[[ -f "$HOME/.dotfiles-env" ]] && current_env=$(cat "$HOME/.dotfiles-env")
if [[ -n "$current_env" ]]; then
echo "Current environment: $current_env"
read -rp "Keep current? [Y/n] " answer
if [[ ! "${answer:-y}" =~ ^[Yy]$ ]]; then
current_env=""
fi
fi
if [[ -z "$current_env" ]]; then
echo "Select environment:"
select env in home work; do
if [[ -n "$env" ]]; then
current_env="$env"
break
fi
done
fi
echo "$current_env" > "$HOME/.dotfiles-env"
echo "Environment set to: $current_env"
echo ""
echo "=== Syncing package databases ==="
if [[ -z "$dry_run" ]]; then
paru -Sy
else
echo "[DRY_RUN]: paru -Sy"
fi
echo ""
echo "=== Phase 1: install packages ==="
"$DOTFILES/run" $dry_run
echo ""
echo "=== Phase 2: deploy configs ==="
"$DOTFILES/deploy" $dry_run
echo ""
echo "=== Phase 3: secrets ==="
if [[ -z "${BWS_ACCESS_TOKEN:-}" ]]; then
echo "BWS_ACCESS_TOKEN not set — skipping secrets."
echo "To provision secrets: export BWS_ACCESS_TOKEN='...' && ./secrets"
elif [[ -n "$dry_run" ]]; then
"$DOTFILES/secrets" $dry_run
else
read -rp "Deploy secrets (gitconfig, gh tokens, etc.)? [y/N] " answer
if [[ "$answer" =~ ^[Yy]$ ]]; then
"$DOTFILES/secrets"
else
echo "Skipped secrets."
fi
fi