Finishing touches

This commit is contained in:
2020-02-25 23:13:21 +00:00
committed by Andrejus
parent c4ce39b965
commit fc5ba9f99d
17 changed files with 157 additions and 121 deletions

View File

@@ -2,32 +2,32 @@
#
# Invokes all install scripts.
#
set -euo pipefail
# Log execution
printf "Installing ${C_CYAN}$repository${C_NC}"
source "$dotfiles_dir/utils.sh"
printf "Installing ${C_CYAN}$REPOSITORY${C_NC}"
printf " as ${C_YELLOW}$USER${C_NC}\n\n"
# Prevent running as root
if [ "$USER" == "root" ]
then
if [[ $USER == root ]]; then
printf "Failed: ${C_RED}Running as root${C_NC}\n"
printf "Please run as user, not ${C_YELLOW}sudo${C_NC}\n"
exit 1
fi
# Prevent concurrent scripts
if [ -f "$lock_file" ]
then
# Prevent concurrent runs
readonly install_lock_file="$dotfiles_dir/.dotlock"
if [ -f $install_lock_file ]; then
printf "Failed: ${C_RED}Script already running${C_NC}\n"
printf "Please wait for script to exit or ${C_YELLOW}make clean${C_NC}\n"
exit 1
fi
touch "$lock_file" # Requires clean
touch "$install_lock_file" # Requires clean
# Run all install scripts
script_filter="$install_dir/*.sh"
for script in $script_filter
do
readonly install_dir="$dotfiles_dir/install"
readonly script_filter="$install_dir/*.sh"
for script in $script_filter; do
# Avoid pattern matching self
[ -e "$script" ] || continue
@@ -38,7 +38,7 @@ do
# Run and indent output
source "$script" | indent
printf "${C_NC}\n"
printf "${C_NC}"
done