dotfiles/install
Errol Sancaktar 75bc98fd3f changing
2025-04-07 17:12:58 +00:00

32 lines
851 B
Bash
Executable File

#!/usr/bin/env bash
set -e
BASE_CONFIG="base"
CONFIG_SUFFIX=".yaml"
CONFIG_DIR="configs"
PROFILES_DIR="profiles"
PROFILE=$(hostname|cut -d"." -f1)
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${BASEi_DIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASE_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "${CONFIG_DIR}/${BASE_CONFIG}${CONFIG_SUFFIX}"
echo "Setting Profile for Host: ${PROFILE}"
if [[ ! -f "${BASE_DIR}/${PROFILES_DIR}/${PROFILE}" ]]; then
echo "Machine Profile $PROFILE not found."
exit 1
fi
while IFS= read -r config; do
"${BASE_DIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASE_DIR}" -c "${CONFIG_DIR}/${config}${CONFIG_SUFFIX}"
done < "${BASE_DIR}/${PROFILES_DIR}/${PROFILE}"