-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·60 lines (51 loc) · 1.23 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
#!/usr/bin/env bash
set -e
function display_usage {
echo "Usage: $0 [-bh]" >&2
echo "-b: Run bootstrap.[pre|post].sh"
echo "-h: Display usage"
}
# execute scripts with given name($0) in all direct subdirectories
function run_install_scripts {
for file in $(find . -not -iwholename '*.git*' -maxdepth 2 -type f -name $1)
do
echo "+++++Executing $file+++++"
source $file
echo -e "-----Executed $file------\n"
done
}
# and then install dotfiles with dotbot
function install_dotfiles {
echo '+++++++Installing dotfiles+++++++'
dotbot -c install.conf.yaml
echo -e '-----Dotfiles are installed------\n'
}
# parse options
BOOTSTRAP='false'
while getopts "bh" opt; do
case $opt in
b)
BOOTSTRAP='true'
;;
h)
display_usage
exit 0
;;
*)
display_usage
exit 1
;;
esac
done
# remove all options processed by getopts
shift $(( OPTIND - 1 ))
[[ "${1}" == "--" ]] && shift
# main
if $BOOTSTRAP; then
run_install_scripts 'bootstrap.pre.sh'
fi
install_dotfiles
if $BOOTSTRAP; then
run_install_scripts 'bootstrap.post.sh'
echo "Now quit your terminal and enjoy your journey with Alacritty + tumx + fish + Neovim ;-)"
fi