dotfiles/install-profile

54 lines
1.4 KiB
Plaintext
Raw Normal View History

2018-06-27 14:33:18 +00:00
#!/usr/bin/env bash
set -e
BASE_CONFIG="base"
CONFIG_SUFFIX=".yaml"
2018-08-19 18:29:34 +00:00
META_DIR="meta"
2021-01-27 20:40:04 +00:00
CONFIG_DIR="tasks"
2018-06-27 14:33:18 +00:00
PROFILES_DIR="profiles"
2020-08-09 15:28:11 +00:00
DOTBOT_DIR="dotbot"
2018-06-27 14:33:18 +00:00
DOTBOT_BIN="bin/dotbot"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${BASE_DIR}"
2023-04-12 13:38:30 +00:00
git -C "${BASE_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${BASE_DIR}"
2018-06-27 14:33:18 +00:00
while IFS= read -r config; do
CONFIGS+=" ${config}"
done < "${META_DIR}/${PROFILES_DIR}/$1"
shift
for config in ${CONFIGS} ${@}; do
echo -e "\nConfigure $config"
2023-04-12 13:38:30 +00:00
# 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}" \
# -p "${BASE_DIR}/${META_DIR}/dotbot-yay/yay.py" -c "$configFile")
cmd=("${BASE_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" \
2023-05-09 18:05:40 +00:00
-p "${BASE_DIR}/dotbot_plugins/dotbot-apt-get/aptget.py" \
2023-05-09 20:07:19 +00:00
-p "${BASE_DIR}/dotbot_plugins/dotbot-conditional/conditional.py" \
2023-05-09 18:05:40 +00:00
-p "${BASE_DIR}/dotbot_plugins/dotbot-pamac/pamac.py" \
-p "${BASE_DIR}/dotbot_plugins/dotbot-yay/yay.py" \
-c "$configFile")
2023-04-12 13:38:30 +00:00
if [[ $config == *"sudo"* ]]; then
cmd=(sudo "${cmd[@]}")
fi
"${cmd[@]}"
rm -f "$configFile"
2018-06-27 14:33:18 +00:00
done
2023-04-12 13:38:30 +00:00
cd "${BASE_DIR}"