-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-profile
executable file
·48 lines (34 loc) · 1.22 KB
/
install-profile
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
#!/usr/bin/env bash
set -e
BASE_CONFIG="base"
CONFIG_SUFFIX=".yaml"
META_DIR="meta"
CONFIG_DIR="configs"
PROFILES_DIR="profiles"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PLUGINS="-p "${META_DIR}/dotbot-brewfile/brewfile.py" "
cd "${BASE_DIR}/meta"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
git submodule update --init --recursive dotbot-brewfile
git submodule update --init --recursive zsh-quickstart-kit
cd "${BASE_DIR}"
git submodule update --init --recursive personal
git submodule update --init --recursive nvim
while IFS= read -r config; do
CONFIGS+=" ${config}"
done < "${META_DIR}/${PROFILES_DIR}/$1"
shift
for config in ${CONFIGS} ${@}; do
echo -e "\nConfigure $config"
# create temporary file
configFile="$(mktemp)"
suffix="-sudo"
echo -e "$(<"${BASE_DIR}/${META_DIR}/${BASE_CONFIG}${CONFIG_SUFFIX}")\n$(<"${BASE_DIR}/${META_DIR}/${CONFIG_DIR}/${config%"$suffix"}${CONFIG_SUFFIX}")" > "$configFile"
cmd=("${BASE_DIR}/${META_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "$configFile" $PLUGINS)
"${cmd[@]}"
rm -f "$configFile"
done
cd "${BASE_DIR}"