Improve install logging

This commit is contained in:
VirtuBox
2019-10-21 12:41:31 +02:00
parent 6eceb5ed35
commit 57130341e6

View File

@@ -27,10 +27,11 @@ TPUT_RESET=$(tput sgr0)
TPUT_FAIL=$(tput setaf 1) TPUT_FAIL=$(tput setaf 1)
TPUT_INFO=$(tput setaf 7) TPUT_INFO=$(tput setaf 7)
TPUT_ECHO=$(tput setaf 4) TPUT_ECHO=$(tput setaf 4)
TPUT_OK=$(tput setaf 2)
wo_lib_echo() { wo_lib_echo() {
echo -e "${TPUT_ECHO}${*}${TPUT_RESET}" echo "${TPUT_ECHO}${*}${TPUT_RESET}"
} }
wo_lib_echo_info() { wo_lib_echo_info() {
@@ -111,15 +112,15 @@ command_exists() {
# run functions and exit on failure # run functions and exit on failure
_run() { _run() {
if [ -n "$2" ]; then if [ -n "$2" ]; then
wo_lib_echo "$2\r" echo -ne "${TPUT_ECHO}${2}${TPUT_RESET}\t"
fi fi
if ! { "$1" >> "$wo_install_log" 2>&1; }; then if ! { "$1" >> "$wo_install_log" 2>&1; }; then
if [ -n "$2" ]; then if [ -n "$2" ]; then
wo_lib_echo_fail "$2" echo -e "${TPUT_FAIL}[KO]${TPUT_RESET}"
fi fi
else else
if [ -n "$2" ]; then if [ -n "$2" ]; then
wo_lib_echo "$2 [OK]" echo -e "${TPUT_OK}[OK]${TPUT_RESET}"
fi fi
fi fi