-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·118 lines (97 loc) · 2.21 KB
/
bootstrap.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
set -e
function configure_base {
SCRIPT_DIR=$(dirname $0)
GIT_ROOT=$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)
GIT_DIR="$SCRIPT_DIR/$(git -C "$SCRIPT_DIR" rev-parse --git-dir)"
export HXDOTFILES_DIR="$GIT_ROOT"
}
function install_base {
## install git configuration
"$HXDOTFILES_DIR/git/bootstrap-git.sh"
## install bash configuration
"$HXDOTFILES_DIR/bash/bootstrap-bash.sh"
## install emacs configuration
"$HXDOTFILES_DIR/emacs/bootstrap-emacs.sh"
}
function configure_osx {
export PLATFORM=osx
}
function install_osx {
configure_base
configure_osx
install_base
}
function configure_linux {
export PLATFORM=linux
}
function install_linux {
configure_base
configure_linux
install_base
}
function configure_cygwin {
export PLATFORM=cygwin
}
function install_cygwin {
loge "!!WARN: Installation on cygwin is not supported yet."
loge " only base installation would be executed, which"
loge " may not function correctly."
loge
configure_base
configure_cygwin
install_base
}
function loge {
echo "$*" >&2
}
function show {
echo $* >&1
}
function main {
case $1 in
config)
case $2 in
show)
show_config
;;
*)
show_help_config
exit 1
esac
;;
install)
case $2 in
osx)
install_osx
;;
cygwin)
install_cygwin
;;
linux)
install_linux
;;
*)
show_help_install
esac
;;
*)
show_help_main
exit 1
esac
}
function show_config {
configure_base
show Git Root = "$GIT_ROOT"
show Git Dir = "$GIT_DIR"
}
function show_help_config {
loge "usage: bootstrap.sh config {show,help}"
}
function show_help_main {
loge "usage: bootstrap.sh {install,config,help}"
}
function show_help_install {
loge "usage: bootstrap.sh install {osx,cygwin,linux}"
}
main $*