-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·41 lines (34 loc) · 942 Bytes
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·41 lines (34 loc) · 942 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
39
40
41
#!/usr/bin/env bash
set -euo pipefail
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET="$HOME"
# Dirs that live in the repo but are NOT stow packages
NON_PACKAGES=(wallpapers)
# Ensure stow is available
if ! command -v stow &>/dev/null; then
if command -v brew &>/dev/null; then
echo "Installing stow via Homebrew..."
brew install stow
else
echo "Error: stow not found and Homebrew is not available. Install stow manually." >&2
exit 1
fi
fi
is_excluded() {
local name="$1"
for excluded in "${NON_PACKAGES[@]}"; do
[[ "$name" == "$excluded" ]] && return 0
done
return 1
}
echo "Stowing packages from $DOTFILES_DIR -> $TARGET"
for dir in "$DOTFILES_DIR"/*/; do
package="$(basename "$dir")"
if is_excluded "$package"; then
echo " skip $package"
continue
fi
echo " stow $package"
stow --dir="$DOTFILES_DIR" --target="$TARGET" --restow "$package"
done
echo "Done."