-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-standalone
executable file
·43 lines (32 loc) · 1.05 KB
/
install-standalone
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
#!/usr/bin/env bash
set -e
BASE_CONFIG="base"
CONFIG_SUFFIX=".yaml"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
META_DIR="${BASE_DIR}/meta"
CONFIG_DIR="${META_DIR}/configs"
PROFILES_DIR="${META_DIR}/profiles"
DOTBOT_DIR="${META_DIR}/.dotbot"
DOTBOT_BIN="bin/dotbot"
DOTBOT_PLUGIN_DIR="${META_DIR}/.dotbot_plugins"
cd "${BASE_DIR}"
git -C "${BASE_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${BASE_DIR}"
for config in ${@}; do
# create temporary file
configFile="$(mktemp)"
suffix="-sudo"
echo -e "$(<"${META_DIR}/${BASE_CONFIG}${CONFIG_SUFFIX}")\n$(<"${CONFIG_DIR}/${config%"$suffix"}${CONFIG_SUFFIX}")" >"$configFile"
cmd=("${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "$configFile"
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-apt"
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-git"
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-snap"
--plugin-dir "${DOTBOT_PLUGIN_DIR}/dotbot-if"
)
if [[ $config == *"sudo"* ]]; then
cmd=(sudo "${cmd[@]}")
fi
"${cmd[@]}"
rm -f "$configFile"
done
cd "${BASE_DIR}"