-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
98 lines (83 loc) · 3.45 KB
/
install.sh
File metadata and controls
98 lines (83 loc) · 3.45 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# ─────────────────────────────────────────────────────────────────────────────
# install.sh — dhmsDots installer entry point
# Clones/updates the repo, then runs each modular script in order.
#
# Usage (remote bootstrap):
# curl -fsSL https://raw.githubusercontent.com/dhms013/dhmsDots/main/install.sh | bash
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
REPO="dhms013/dhmsDots"
BRANCH="main"
export DOTFILES_DIR="$HOME/.dhmsDots"
SCRIPTS_DIR="$DOTFILES_DIR/packages/scripts"
# ── 1. Bootstrap: clone or update the repo ───────────────────────────────────
bootstrap_repo() {
if [ -d "$DOTFILES_DIR" ]; then
echo "==> Updating existing dotfiles repo"
git -C "$DOTFILES_DIR" pull
else
echo "==> Cloning dhmsDots"
git clone --depth=1 "https://github.com/$REPO.git" "$DOTFILES_DIR"
fi
}
# ── 2. Sudo keepalive (runs in background for duration of script) ─────────────
sudo_keepalive() {
echo "==> This script requires sudo. Please enter your password:"
sudo -v
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
}
# ── 3. Source a module script ─────────────────────────────────────────────────
run_module() {
local script="$SCRIPTS_DIR/$1"
if [ -f "$script" ]; then
bash "$script"
else
echo "==> Warning: module not found: $script"
fi
}
# ── 4. Countdown reboot ───────────────────────────────────────────────────────
reboot_countdown() {
echo ""
echo "╔════════════════════════════════════════════╗"
echo "║ Setup complete! Rebooting to start ║"
echo "║ Hyprland with your new configuration. ║"
echo "╚════════════════════════════════════════════╝"
echo ""
gum spin --spinner "globe" --title "Rebooting in" --show-output -- \
bash -c '
for i in 5 4 3 2 1; do
echo -n "$i... "
sleep 1
done
echo "0"
'
echo ""
echo "Rebooting now..."
systemctl reboot
}
# ── Main ──────────────────────────────────────────────────────────────────────
sudo_keepalive
# Pre-flight: ensure git is available before cloning
if ! command -v git >/dev/null; then
echo "==> git not found, installing..."
sudo pacman -S --needed --noconfirm git
fi
bootstrap_repo
cd "$DOTFILES_DIR"
run_module logo.sh
run_module resolver.sh
sudo usermod -aG input "${USER}"
run_module install.sh
run_module dotfiles.sh
run_module services.sh
run_module theme.sh
run_module dirs.sh
run_module defaults.sh
run_module sddm.sh
run_module uninstall.sh
reboot_countdown