-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·39 lines (33 loc) · 1.01 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
#!/bin/bash
SRC="${1:-${HOME}/src/dotfiles}"
OS="$(uname -s)"
# These are not true dotfiles (e.g. iTerm settings), but it's nice to have them
# in the repo. Packages in this array will be kept away from stow
excluded_packages=(
iterm
windows
)
if [[ "${OS}" != "Darwin" ]]; then
excluded_packages+=(macos)
fi
find_cmd=(
"find" "${SRC}"
"-maxdepth" "1"
"!" "-path" "${SRC}"
"-type" "d"
"-not" "-name" ".git"
"-and" "-not" "-name" "."
)
# bash makes me want to barf sometimes
# I also probably over engineered the hell out of this given how few symlink
# packages we care about
read -r -a exclude_args <<<"${excluded_packages[@]/#/-and -not -name }"
find_cmd+=("${exclude_args[@]}")
find_cmd+=("-exec" "basename" "{}" "\\" ";")
# Get all directories inside source dir, except the dir itself and .git, and stow things
packages=$("${find_cmd[@]}")
# shellcheck disable=SC2250
for package in $packages; do
printf "Stowing %s\n" "${package}"
stow -R --target="${HOME}" "${package}"
done