-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·85 lines (78 loc) · 1.49 KB
/
install.sh
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
#!/usr/bin/env bash
set -u
set -o pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
if ! type stow >/dev/null 2>&1; then
echo "stow is not installed" >&2
exit 1
fi
packages=()
dry_run=0
while getopts ":dp:" o; do
case $o in
d) dry_run=1 ;;
p) packages+=("$OPTARG") ;;
:)
echo "'$1' requires an argument" >&2
exit 1
;;
?)
echo "Unknown flag '$1'" >&2
exit 1
;;
esac
done
if [ "${#packages[@]}" -eq 0 ]; then
packages+=(
"aerc"
"bash"
"bat"
"clangd"
"deno"
"difftastic"
"dir_colors"
"dotnet"
"editline"
"fzf"
"gdb"
"git"
"glow"
"go"
"info"
"jq"
"jupyter"
"kubernetes"
"less"
"meson"
"neovim"
"nix"
"nnn"
"nodejs"
"postgresql"
"programs"
"python"
"readline"
"ripgrep"
"rust"
"ssh"
"terraform"
"tmux"
"vim"
"wget"
"xdg"
"zoxide"
)
fi
for p in "${packages[@]}"; do
if [ $dry_run -eq 1 ]; then
echo Installing "$p" "(dry run)"
stow --no --dir "$SCRIPT_DIR" --restow "$p" 2>/dev/null
else
echo Installing "$p"
stow --dir "$SCRIPT_DIR" --restow "$p"
fi
status=$?
if [ $status -ne 0 ]; then
exit $status
fi
done