X-Git-Url: https://arthur.barton.de/gitweb/?p=netdata.git;a=blobdiff_plain;f=netdata-installer.sh;h=6b672a242e8ad5c04d45a1dfa832e496860e1e33;hp=c49ef32ceb2d14dbc2f4b486351e4db00b7c871c;hb=f74a2240c8b8e7a469170d6300bfd4fb79ef52c1;hpb=cdf6740f46999b1b15665feb9eea7593c0aafc3c diff --git a/netdata-installer.sh b/netdata-installer.sh index c49ef32c..6b672a24 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -104,6 +104,12 @@ Valid are: Enable/disable the FreeIPMI plugin. Default: enable it when libipmimonitoring is available. + --enable-plugin-nfacct + --disable-plugin-nfacct + + Enable/disable the nfacct plugin. + Default: enable it when libmnl and libnetfilter_acct are available. + --enable-lto --disable-lto @@ -205,6 +211,14 @@ do then NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --disable-plugin-freeipmi" shift 1 + elif [ "$1" = "--enable-plugin-nfacct" ] + then + NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --enable-plugin-nfacct" + shift 1 + elif [ "$1" = "--disable-plugin-nfacct" ] + then + NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --disable-plugin-nfacct" + shift 1 elif [ "$1" = "--enable-lto" ] then NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --enable-lto" @@ -507,6 +521,24 @@ then fi fi +config_signature_matches() { + local md5="${1}" file="${2}" + + if [ "${BASH_VERSINFO[0]}" -ge "4" ] + then + [ "${configs_signatures[${md5}]}" = "${file}" ] && return 0 + return 1 + fi + + if [ -f "configs.signatures" ] + then + grep "\['${md5}'\]='${file}'" "configs.signatures" >/dev/null + return $? + fi + + return 1 +} + # backup user configurations installer_backup_suffix="${PID}.${RANDOM}" for x in $(find "${NETDATA_PREFIX}/etc/netdata/" -name '*.conf' -type f) @@ -534,19 +566,13 @@ do cp "conf.d/${f}" "${x}.orig" fi - if [ "${BASH_VERSINFO[0]}" -ge "4" ] - then - if [ "${configs_signatures[${md5}]}" = "${f}" ] + if config_signature_matches "${md5}" "${f}" then - # it is a stock version - don't keep it - echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' is stock version." - else - # edited by user - keep it - 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 + # it is a stock version - don't keep it + echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' is stock version." else - echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RET}cannot be checked for custom edits${TPUT_RESET}. Keeping it." + # edited by user - keep it + 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 fi @@ -1328,7 +1354,7 @@ if [ -t 2 ] else # we are headless # create a temporary file for the log - tmp=\$(mktemp /tmp/netdata-updater-log-XXXXXX.log) + tmp=\$(mktemp /tmp/netdata-updater.log.XXXXXX) # open fd 3 and send it to tmp exec 3>\${tmp} fi @@ -1408,11 +1434,19 @@ REINSTALL echo >&2 echo >&2 "${TPUT_DIM}${TPUT_BOLD}netdata-updater.sh${TPUT_RESET}${TPUT_DIM} can work from cron. It will trigger an email from cron" echo >&2 "only if it fails (it does not print anything if it can update netdata).${TPUT_RESET}" - if [ "${UID}" -eq 0 -a -d "/etc/cron.daily" -a ! -f "/etc/cron.daily/netdata-updater.sh" ] - then - echo >&2 "${TPUT_DIM}Run this to automatically check and install netdata updates once per day:${TPUT_RESET}" - echo >&2 - echo >&2 "${TPUT_YELLOW}${TPUT_BOLD}ln -s ${PWD}/netdata-updater.sh /etc/cron.daily/netdata-updater.sh${TPUT_RESET}" + if [ "${UID}" -eq "0" ] + then + if [ -d "/etc/cron.daily" -a ! -f "/etc/cron.daily/netdata-updater.sh" ] + then + echo >&2 "${TPUT_DIM}Run this to automatically check and install netdata updates once per day:${TPUT_RESET}" + echo >&2 + echo >&2 "${TPUT_YELLOW}${TPUT_BOLD}ln -s ${PWD}/netdata-updater.sh /etc/cron.daily/netdata-updater.sh${TPUT_RESET}" + elif [ -d "/etc/periodic/daily" -a ! -f "/etc/periodic/daily/netdata-updater" ] + then + echo >&2 "${TPUT_DIM}Run this to automatically check and install netdata updates once per day:${TPUT_RESET}" + echo >&2 + echo >&2 "${TPUT_YELLOW}${TPUT_BOLD}ln -s ${PWD}/netdata-updater.sh /etc/periodic/daily/netdata-updater${TPUT_RESET}" + fi fi elif [ -f "netdata-updater.sh" ] then