-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·56 lines (44 loc) · 1.12 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
#!/usr/bin/env bash
# expands non-matching globs to zero arguments, rather than to themselves
shopt -s nullglob
#
# Set magic variables for current file & dir
#
readonly __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly __file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
readonly __base="$(basename ${__file} .sh)"
readonly __root="$(cd "$(dirname "${__dir}")" && pwd)"
action="${1:-}"
flag="${2:-}"
# some functions to make my life easier
source "${__dir}/scripts/00_helpers.sh"
source "${__dir}/bootstrap/50-stow.sh"
bootstrap() {
if [[ -e "/etc/debian_version" ]]; then
source "environment/ubuntu.sh"
elif [[ -e "/etc/arch-release" ]]; then
source "environment/arch.sh"
else
warn "Chances are this script will break."
exit 1
fi
for script in "${__dir}/bootstrap/*.sh"; do
cd "${__dir}"
source "$script"
done
}
print_help() {
echo "bootstrap or stow"
exit 0;
}
main() {
case "$action" in
"stow")
stow_packages "${flag}";;
"bootstrap")
bootstrap;;
*)
print_help;;
esac
}
main;