Tweak setup.sh

This commit is contained in:
2020-02-21 17:31:14 +00:00
parent 997af377de
commit 6eb35fff4d
2 changed files with 43 additions and 7 deletions

17
colors.sh Normal file
View File

@@ -0,0 +1,17 @@
C_BLACK='\033[0;30m'
C_DGRAY='\033[1;30m'
C_RED='\033[0;31m'
C_LRED='\033[1;31m'
C_GREEN='\033[0;32m'
C_LGREEN='\033[1;32m'
C_ORANGE='\033[0;33m'
C_YELLOW='\033[1;33m'
C_BLUE='\033[0;34m'
C_LBLUE='\033[1;34m'
C_PURPLE='\033[0;35m'
C_LPURPLE='\033[1;35m'
C_CYAN='\033[0;36m'
C_LCYAN='\033[1;36m'
C_LGRAY='\033[0;37m'
C_WHITE='\033[1;37m'
C_NC='\033[0m'

33
setup.sh Normal file → Executable file
View File

@@ -1,13 +1,32 @@
#!/bin/bash #!/bin/bash
CYAN='\033[0;36m' dir=`dirname "$0"`
NC='\033[0m' source "$dir/colors.sh"
echo "${CYAN}andrejusk/dotfiles${NC}" printf "${C_CYAN}andrejusk/dotfiles${C_NC}\n"
# Check if running
lock_file="$dir/setup.lock"
if [ -f "$dir/.lock" ]; then
printf "${C_RED}Script already running${C_NC}\n"
exit 1
elif
touch
fi
# Check for root
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "sudo !!" printf "${C_RED}Called without sudo, please run:${C_NC}\n"
printf "sudo !!\n\n"
exit 1 exit 1
fi fi
install_dir="$0/install" # Run all install scripts
state_dir="$install_dir/.state" install_dir="$dir/install"
for script in $install_dir/*.sh; do sh $script; done for script in $install_dir/*.sh;
do
if [ -f "$script.lock" ]; then
printf "$script\n"
fi
printf $script
# sh $script;
done