-
Notifications
You must be signed in to change notification settings - Fork 10
/
stowAll.sh
executable file
·51 lines (44 loc) · 989 Bytes
/
stowAll.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
#!/bin/bash
Help()
{
# Display Help
echo "Use GNU stow to stash all config in appropriate place"
echo
echo "Syntax: stowAll.sh [ -i | h ] "
echo "options:"
echo "i ignore these directories"
echo "h Print this help and exit"
echo
echo "example ./stowAll.sh -i 'sway scripts' "
echo
}
DOTFILE_DIR="$HOME/.dotfiles"
while getopts i:h flag
do
case "${flag}" in
i) ignore="$ignore ${OPTARG}";;
h)
Help
exit;;
esac
done
# stow all packages
if command -v stow &> /dev/null
then
for entry in "$DOTFILE_DIR"/*
do
package="$(basename $entry)"
if [[ -d $package ]]
then
if [[ $ignore == *"$package"* ]]
then
echo "ignoring "$(basename $entry)
else
echo "stowing: "$(basename $entry)
stow $(basename $entry)
fi
fi
done
else
echo "GNU stow command not found"
fi