-
Notifications
You must be signed in to change notification settings - Fork 2
/
install
executable file
·44 lines (38 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
#!/usr/bin/env bash
set -e
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIGDIR="${BASEDIR}/meta/config"
DOTBOT="${BASEDIR}/installer/dotbot/bin/dotbot"
PLUGINDIR="${BASEDIR}/installer/plugins"
# Parse arguments
declare -a CONFIGS
declare -a FLAGS
while (( "$#" )); do
case "$1" in
-*)
FLAGS+=("$1")
;;
*)
CONFIGS+=("$1")
;;
esac
shift
done
# Load configuration
for config in base "${CONFIGS[@]}"; do
echo -e "Adding configuration $config"
CONFIGCONTENT="${CONFIGCONTENT}\n$(<"${CONFIGDIR}/${config}.yaml")"
done
# Get Plugins
declare -a PLUGINS
PLUGINS=("--plugin-dir" "${PLUGINDIR}" \
"--plugin-dir" "${PLUGINDIR}/dotbot-ifplatform" \
"--plugin-dir" "${PLUGINDIR}/dotbot-template" \
"--plugin-dir" "${PLUGINDIR}/dotbot-pip" \
"--plugin-dir" "${PLUGINDIR}/dotbot-sudo")
# Run dotbot
if [[ "${#FLAGS[@]}" -gt 0 ]]; then
"${DOTBOT}" "${FLAGS[@]}" -d "${BASEDIR}" "${PLUGINS[@]}" -c <(echo -e "${CONFIGCONTENT}")
else
"${DOTBOT}" -d "${BASEDIR}" "${PLUGINS[@]}" -c <(echo -e "${CONFIGCONTENT}")
fi