-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·53 lines (44 loc) · 900 Bytes
/
setup.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
#!/bin/zsh
unsetopt nomatch
function CFPreferencesAppSynchronize() {
python - <<END
from Foundation import CFPreferencesAppSynchronize
CFPreferencesAppSynchronize('$1')
END
}
HELPERS="$PWD/helpers"
SETUP_INDICATOR="💥"
DONE_INDICATOR="💻"
function runSetup {
if [ -d ./$1/$2 ]; then
if [ -f ./$1/$2/$2.sh ]; then
SETUP=./$1/$2
source ./$1/$2/$2.sh
fi
for file in $PWD/$1/$2/.* ; do
ln -s $file ~
done
elif [ -f ./$1/$2.sh ]; then
SETUP=./$1
source ./$1/$2.sh
fi
}
function processSetup {
echo "\n$SETUP_INDICATOR ${1%.sh}"
runSetup willSetup ${1%.sh}
runSetup setup ${1%.sh}
runSetup didSetup ${1%.sh}
}
function processAll {
for entry in ./$1/[^_]* ;do
processSetup ${entry##*/}
done
}
if [ "$1" ]; then
processSetup $1
else
processAll willSetup
processAll setup
processAll didSetup
fi
echo "$DONE_INDICATOR"