#!/bin/bash # # This is a config-management system that I built, but don't use anymore. It was a learning experience that I've since upgraded # As it was a learning experience, there's a lot of sadness in here. Be wary! # Check out interfaces.sh for an implimentation of what sub-scripts are run # # check if configs is locked check_lock=$(wget --quiet -O /dev/stdout "lockcheck.somehost.com?file=configs" | awk '{print $1;}') if [ ${check_lock} != "free" ]; then echo "configs is locked, giving up" exit 1 fi source "/etc/configs/scripts/envs.sh" ln -s "${configs_dir}/init.sh" /usr/local/sbin/configs.sh 2>&1 | grep -vE "^ln: failed to create symbolic link (‘/usr/local/sbin/configs.sh’|'/usr/local/sbin/configs.sh'): File exists\$" chmod +x "${configs_dir}/init.sh" # call scripts from functions.sh scripts # Just want to do this once and get all packages installed=$(sed 's/:armhf//g' <<< "$(dpkg --list | awk '{print $2;}')") for package in ${packages}; do grep -E "^${package}$" <<< "${installed}" > /dev/null if [ $? -ne 0 ]; then needs_installed="yes" fi done if [ -n "${needs_installed}" ]; then apt-get -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install --yes ${packages} 2>&1 | grep -vE "Reading database" fi for user in ${users}; do if [[ "${active_users}" == *"${user}"* ]]; then bash "${configs_dir}/scripts/users.sh" "${user}" "active" else bash "${configs_dir}/scripts/users.sh" "${user}" fi done bash "${configs_dir}/scripts/services.mgmt.sh" # to make sure hard drives aren't dying touch /usr/local/.test rm /usr/local/.test