-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·49 lines (41 loc) · 1.05 KB
/
install
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
#!/usr/bin/env bash
set -e
die () {
echo >&2 "${@}"
exit 1
}
[ "${#}" -ge 2 ] || die "usage: install [-t THEME] (...dotbot OPTIONS...)"
case "${1}" in
-t|--theme)
case "${2}" in
an-94|prose|metamorphosis|grimoire)
echo "Theme selected for install: ${2}"
THEME="${2}"
;;
*)
die "${2} is not a valid theme"
esac
;;
*)
die "usage: install [-t THEME] (...dotbot OPTIONS...)"
esac
args=()
rflag=false
for var in "${@}"; do
if [[ "${rflag}" == true ]] ; then
rflag=false
continue
elif [[ "${var}" == "--theme" ]] || [[ "${var}" == "-t" ]] ; then
rflag=true
continue
fi
args+=("${var}")
done
CONFIG="${THEME}/install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}/${THEME}" --plugin-dir crontab-dotbot -c "${CONFIG}" "${args[@]}"