X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=netdata-installer.sh;h=584e2e67b28597b3e35e6a44afee4dcec0dd06af;hb=c97eaeb9dfad7190e03c0ca264ea6ae76f404edd;hp=f8a7deea7f27146c2c7b72894e4ee24df3ae9da1;hpb=e099b5abf7534d92367e9751bcd7630dba8f086a;p=netdata.git diff --git a/netdata-installer.sh b/netdata-installer.sh index f8a7deea..584e2e67 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -202,25 +202,32 @@ do done netdata_banner "real-time performance monitoring, done right!" -cat <&2 -ep \$'\001${COLOR_BOLD}${COLOR_GREEN}\002Press ENTER to build and install netdata to \'\001${COLOR_CYAN}\002${NETDATA_PREFIX}\001${COLOR_YELLOW}\002\'\001${COLOR_RESET}\002 > ' -e -r REPLY" + eval "read >&2 -ep \$'\001${TPUT_BOLD}${TPUT_GREEN}\002Press ENTER to build and install netdata to \'\001${TPUT_CYAN}\002${NETDATA_PREFIX}\001${TPUT_YELLOW}\002\'\001${TPUT_RESET}\002 > ' -e -r REPLY" else - eval "read >&2 -ep \$'\001${COLOR_BOLD}${COLOR_GREEN}\002Press ENTER to build and install netdata to your system\001${COLOR_RESET}\002 > ' -e -r REPLY" + eval "read >&2 -ep \$'\001${TPUT_BOLD}${TPUT_GREEN}\002Press ENTER to build and install netdata to your system\001${TPUT_RESET}\002 > ' -e -r REPLY" fi fi @@ -480,7 +487,8 @@ do if [ -z "${md5sum}" -o ! -x "${md5sum}" ] then # we don't have md5sum - keep it - cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}" + echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RET}is not known to distribution${TPUT_RESET}. Keeping it." + run cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}" else # find it relative filename f="${x/*\/etc\/netdata\//}" @@ -499,15 +507,15 @@ do if [ "${configs_signatures[${md5}]}" = "${f}" ] then # it is a stock version - don't keep it - echo >&2 "File '${x}' is stock version." + echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' is stock version." else # edited by user - keep it - echo >&2 "File '${x}' has been edited by user." - cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}" + echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RED} has been edited by user${TPUT_RESET}. Keeping it." + run cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}" fi else - echo >&2 "File '${x}' cannot be check for custom edits." - cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}" + echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RET}cannot be checked for custom edits${TPUT_RESET}. Keeping it." + run cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}" fi fi @@ -525,14 +533,14 @@ run make install || exit 1 # ----------------------------------------------------------------------------- -progress "Restore netdata configuration files" +progress "Restore user edited netdata configuration files" for x in $(find "${NETDATA_PREFIX}/etc/netdata/" -name '*.conf' -type f) do if [ -f "${x}.installer_backup.${installer_backup_suffix}" ] then - cp -p "${x}.installer_backup.${installer_backup_suffix}" "${x}" - rm -f "${x}.installer_backup.${installer_backup_suffix}" + run cp -p "${x}.installer_backup.${installer_backup_suffix}" "${x}" && \ + run rm -f "${x}.installer_backup.${installer_backup_suffix}" fi done @@ -560,9 +568,11 @@ if [ ${UID} -eq 0 ] portable_add_user_to_group varnish netdata && NETDATA_ADDED_TO_VARNISH=1 portable_add_user_to_group haproxy netdata && NETDATA_ADDED_TO_HAPROXY=1 portable_add_user_to_group adm netdata && NETDATA_ADDED_TO_ADM=1 + run_ok +else + run_failed "The installer does not run as root." fi - # ----------------------------------------------------------------------------- progress "Install logrotate configuration for netdata" @@ -858,7 +868,7 @@ stop_all_netdata() { myns="$(readlink /proc/self/ns/pid 2>/dev/null)" - echo >&2 "Stopping a (possibly) running netdata..." + # echo >&2 "Stopping a (possibly) running netdata (namespace '${myns}')..." for p in $(cat "${NETDATA_RUN_DIR}/netdata.pid" 2>/dev/null) \ $(cat /var/run/netdata.pid 2>/dev/null) \ @@ -974,15 +984,15 @@ progress "Check KSM (kernel memory deduper)" ksm_is_available_but_disabled() { cat </sys/kernel/mm/ksm/run${COLOR_RESET}") - $(printf "${COLOR_YELLOW}${COLOR_BOLD}echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs${COLOR_RESET}") + ${TPUT_YELLOW}${TPUT_BOLD}echo 1 >/sys/kernel/mm/ksm/run${TPUT_RESET} + ${TPUT_YELLOW}${TPUT_BOLD}echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs${TPUT_RESET} If you enable it, you will save 40-60% of netdata memory. @@ -992,7 +1002,7 @@ KSM1 ksm_is_not_available() { cat <&2 -e "Uninstall script generated: ${COLOR_YELLOW}${COLOR_BOLD}./netdata-uninstaller.sh${COLOR_RESET}" +echo >&2 "Uninstall script generated: ${TPUT_YELLOW}${TPUT_BOLD}./netdata-uninstaller.sh${TPUT_RESET}" if [ -d .git ] then @@ -1337,7 +1347,7 @@ update && exit 0 REINSTALL chmod 755 netdata-updater.sh.new mv -f netdata-updater.sh.new netdata-updater.sh - echo >&2 -e "Update script generated : ${COLOR_YELLOW}${COLOR_BOLD}./netdata-updater.sh${COLOR_RESET}" + echo >&2 "Update script generated : ${TPUT_YELLOW}${TPUT_BOLD}./netdata-updater.sh${TPUT_RESET}" elif [ -f "netdata-updater.sh" ] then rm "netdata-updater.sh"