diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:56:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:56:05 +0000 |
commit | 54deae27eed83a162ee438ef6bad4a23767757dd (patch) | |
tree | da5333377dfacf22177375aef822a8e696f007eb /packaging/installer/kickstart-static64.sh | |
parent | Releasing debian version 1.14.0-1. (diff) | |
download | netdata-54deae27eed83a162ee438ef6bad4a23767757dd.tar.xz netdata-54deae27eed83a162ee438ef6bad4a23767757dd.zip |
Merging upstream version 1.15.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/kickstart-static64.sh')
-rwxr-xr-x | packaging/installer/kickstart-static64.sh | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/packaging/installer/kickstart-static64.sh b/packaging/installer/kickstart-static64.sh index 6ef3a123..50517905 100755 --- a/packaging/installer/kickstart-static64.sh +++ b/packaging/installer/kickstart-static64.sh @@ -32,13 +32,27 @@ setup_terminal() { return 0 } +setup_terminal || echo >/dev/null -progress() { - echo >&2 " --- ${TPUT_DIM}${TPUT_BOLD}${*}${TPUT_RESET} --- " +# ----------------------------------------------------------------------------- +fatal() { + printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} ABORTED ${TPUT_RESET} ${*} \n\n" + exit 1 +} + +run_ok() { + printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} ${*} \n\n" } +run_failed() { + printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET} ${*} \n\n" +} + +ESCAPED_PRINT_METHOD= +printf "%q " test >/dev/null 2>&1 +[ $? -eq 0 ] && ESCAPED_PRINT_METHOD="printfq" escaped_print() { - if printf "%q " test >/dev/null 2>&1; then + if [ "${ESCAPED_PRINT_METHOD}" = "printfq" ]; then printf "%q " "${@}" else printf "%s" "${*}" @@ -46,24 +60,39 @@ escaped_print() { return 0 } +progress() { + echo >&2 " --- ${TPUT_DIM}${TPUT_BOLD}${*}${TPUT_RESET} --- " +} + +run_logfile="/dev/null" run() { - local dir="${PWD}" info_console + local user="${USER--}" dir="${PWD}" info info_console if [ "${UID}" = "0" ]; then + info="[root ${dir}]# " info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]# " else + info="[${user} ${dir}]$ " info_console="[${TPUT_DIM}${dir}${TPUT_RESET}]$ " fi - escaped_print "${info_console}${TPUT_BOLD}${TPUT_YELLOW}" "${@}" "${TPUT_RESET}\n" >&2 + printf >>"${run_logfile}" "${info}" + escaped_print >>"${run_logfile}" "${@}" + printf >>"${run_logfile}" " ... " + + printf >&2 "${info_console}${TPUT_BOLD}${TPUT_YELLOW}" + escaped_print >&2 "${@}" + printf >&2 "${TPUT_RESET}\n" "${@}" local ret=$? if [ ${ret} -ne 0 ]; then - printf >&2 "${TPUT_BGRED}${TPUT_WHITE}${TPUT_BOLD} FAILED ${TPUT_RESET} ${*} \n\n" + run_failed + printf >>"${run_logfile}" "FAILED with exit code ${ret}\n" else - printf >&2 "${TPUT_BGGREEN}${TPUT_WHITE}${TPUT_BOLD} OK ${TPUT_RESET} ${*} \n\n" + run_ok + printf >>"${run_logfile}" "OK\n" fi return ${ret} @@ -130,8 +159,6 @@ sudo="" [ -z "${UID}" ] && UID="$(id -u)" [ "${UID}" -ne "0" ] && sudo="sudo" -setup_terminal || echo >/dev/null - # --------------------------------------------------------------------------------------------------------------------- if [ "$(uname -m)" != "x86_64" ]; then fatal "Static binary versions of netdata are available only for 64bit Intel/AMD CPUs (x86_64), but yours is: $(uname -m)." |