@@ -6,6 +6,8 @@ set -eo pipefail
66#
77
88if [[ -t 1 && -n " $TERM " && " $TERM " != " dumb" ]]; then
9+ CYAN=" \033[0;36m"
10+ CYAN_BOLD=" \033[1;36m"
911 RED=" \033[1;31m"
1012 GREEN=" \033[1;32m"
1113 YELLOW=" \033[1;33m"
1921 NC=" "
2022fi
2123
22- printf " \n\t${GREEN } <<< dots >>> ${NC} \n"
24+ printf " \n\t${CYAN } <<< ${CYAN_BOLD} dots${CYAN} >>> ${NC} \n"
2325printf " \t${GREY} ==============${NC} \n\n"
2426
2527# Prevent running as root
3032
3133# Ensure sudo credentials are cached
3234if [[ -z " $SKIP_SUDO_CHECK " ]]; then
33- echo -e " ${GREY } Checking sudo credentials...${NC} "
35+ echo -e " ${YELLOW } Checking sudo credentials...${NC} "
3436 sudo -v
3537fi
3638
@@ -69,12 +71,12 @@ targets=($@)
6971
7072# Run install scripts
7173run () {
72- echo -e " ${GREY} Running \" $( basename " $0 " ) \" at \" $( date) \" ${NC} "
73- echo -e " ${GREY} Running as \" $( whoami) \" on \" $( hostname) \" ${NC} "
74+ echo -e " Running \" $( basename " $0 " ) \" at \" $( date) \" "
75+ echo -e " Running as \" $( whoami) \" on \" $( hostname) \" "
7476 if [[ -n " $targets " ]]; then
75- echo -e " ${GREY} Running ${# targets[@]} install target(s): ${targets[@]}${NC} "
77+ echo -e " Running ${YELLOW} ${# targets[@]}${NC} install target(s): ${YELLOW} ${targets[@]}${NC}"
7678 else
77- echo -e " ${GREY} Running all install targets${NC} "
79+ echo -e " Running all install targets"
7880 fi
7981
8082 for script in $install_dir /* .sh; do
@@ -88,27 +90,31 @@ run() {
8890
8991 local script_name=$( basename $script )
9092
91- printf " \n\n${GREY } <<< $script_name :${NC} \n"
93+ printf " \n\n${CYAN } <<< ${CYAN_BOLD} $script_name :${NC} \n"
9294 local start_time=$( date +%s.%N)
9395 source $script
9496 local end_time=$( date +%s.%N)
9597 local execution_time=$( echo " $end_time - $start_time " | bc)
9698 local execution_ms=$( echo " $execution_time * 1000" | bc | awk ' {printf "%.0f", $0}' )
9799 local execution_ms_formatted=$( printf " %'.0f" " $execution_ms " )
98100 local time_color=" $GREY "
99- if (( execution_ms > 1000 )) ; then
101+ if (( execution_ms < 2000 )) ; then
102+ time_color=" $GREEN "
103+ elif (( execution_ms < 5000 )) ; then
104+ time_color=" $YELLOW "
105+ else
100106 time_color=" $RED "
101107 fi
102- printf " \n${GREY } >>> $script_name , "
108+ printf " \n${CYAN } >>> ${CYAN_BOLD}${ script_name} , ${NC} "
103109 printf " completed in ${time_color}${execution_ms_formatted} ms${NC} \n"
104110 done
105111}
106- echo -e " \n ${GREY} install : Logging to \" $log_abs_target \" ${NC} "
112+ echo -e " \ninstall : Logging to \" $log_abs_target \" "
107113start_time=$( date +%s.%N)
108114run 2>&1 | tee " $log_abs_target "
109115end_time=$( date +%s.%N)
110116
111117total_time_raw=$( echo " $end_time - $start_time " | bc)
112118total_time=$( echo " $total_time_raw " | awk ' {printf "%.3g", $1}' )
113- echo -e " \n ${GREY} Thank you!${NC} "
114- echo -e " ${GREY} Total time: ${GREEN}${total_time} s${NC} \n"
119+ echo -e " \nThank you!"
120+ echo -e " Total time: ${GREEN}${total_time} s${NC} \n"
0 commit comments