X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=netdata-installer.sh;h=d6e78681b592afb7aed7020e4ab549a3c6d87452;hb=2ef8a7aaa94193a9d943eb15e4e2ff4b357ad62c;hp=1a3e1a188cdcc8605e89313a41e799075c3bc0f5;hpb=c50ec4efef94710302a2da98b78d8a2bfc567c35;p=netdata.git diff --git a/netdata-installer.sh b/netdata-installer.sh index 1a3e1a18..d6e78681 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -3,6 +3,8 @@ # reload the user profile [ -f /etc/profile ] && . /etc/profile +export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" + # fix PKG_CHECK_MODULES error if [ -d /usr/share/aclocal ] then @@ -47,50 +49,50 @@ NETDATA_PREFIX= LIBS_ARE_HERE=0 usage() { - cat <<-USAGE + cat < +${ME} - Valid are: +Valid are: - --install /PATH/TO/INSTALL + --install /PATH/TO/INSTALL - If your give: --install /opt - netdata will be installed in /opt/netdata + If your give: --install /opt + netdata will be installed in /opt/netdata - --dont-start-it + --dont-start-it - Do not (re)start netdata. - Just install it. + Do not (re)start netdata. + Just install it. - --dont-wait + --dont-wait - Do not wait for the user to press ENTER. - Start immediately building it. + Do not wait for the user to press ENTER. + Start immediately building it. - --zlib-is-really-here - --libs-are-really-here + --zlib-is-really-here + --libs-are-really-here - If you get errors about missing zlib, - or libuuid but you know it is available, - you have a broken pkg-config. - Use this option to allow it continue - without checking pkg-config. + If you get errors about missing zlib, + or libuuid but you know it is available, + you have a broken pkg-config. + Use this option to allow it continue + without checking pkg-config. - Netdata will by default be compiled with gcc optimization -O3 - If you need to pass different CFLAGS, use something like this: +Netdata will by default be compiled with gcc optimization -O3 +If you need to pass different CFLAGS, use something like this: - CFLAGS="" ${ME} + CFLAGS="" ${ME} - For the installer to complete successfully, you will need - these packages installed: +For the installer to complete successfully, you will need +these packages installed: - gcc make autoconf automake pkg-config zlib1g-dev (or zlib-devel) - uuid-dev (or libuuid-devel) + gcc make autoconf automake pkg-config zlib1g-dev (or zlib-devel) + uuid-dev (or libuuid-devel) - For the plugins, you will at least need: +For the plugins, you will at least need: - curl nodejs + curl nodejs USAGE } @@ -172,26 +174,26 @@ do fi done -cat <<-BANNER +cat </sys/kernel/mm/ksm/run - echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs +echo 1 >/sys/kernel/mm/ksm/run +echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs - If you enable it, you will save 40-60% of netdata memory. +If you enable it, you will save 40-60% of netdata memory. KSM1 } ksm_is_not_available() { - cat <<-KSM2 + cat <netdata-uninstaller.sh <<-UNINSTALL - #!/bin/bash +cat >netdata-uninstaller.sh <&2 "This script will REMOVE netdata from your system." - echo >&2 "Run it again with --force to do it." - exit 1 - fi - - echo >&2 "Stopping a possibly running netdata..." - for p in \$(pidof netdata); do kill \$p; done - sleep 2 +if [ "\$1" != "--force" ] + then + echo >&2 "This script will REMOVE netdata from your system." + echo >&2 "Run it again with --force to do it." + exit 1 +fi - deletedir() { - if [ ! -z "\$1" -a -d "\$1" ] - then - echo - echo "Deleting directory '\$1' ..." - rm -I -R "\$1" - fi - } +echo >&2 "Stopping a possibly running netdata..." +for p in \$(pidof netdata); do kill \$p; done +sleep 2 - if [ ! -z "${NETDATA_PREFIX}" -a -d "${NETDATA_PREFIX}" ] +deletedir() { + if [ ! -z "\$1" -a -d "\$1" ] then - # installation prefix was given - - deletedir "${NETDATA_PREFIX}" + echo + echo "Deleting directory '\$1' ..." + rm -I -R "\$1" + fi +} - else - # installation prefix was NOT given +if [ ! -z "${NETDATA_PREFIX}" -a -d "${NETDATA_PREFIX}" ] + then + # installation prefix was given - if [ -f "${NETDATA_PREFIX}/usr/sbin/netdata" ] - then - echo "Deleting ${NETDATA_PREFIX}/usr/sbin/netdata ..." - rm -i "${NETDATA_PREFIX}/usr/sbin/netdata" - fi + deletedir "${NETDATA_PREFIX}" - deletedir "${NETDATA_PREFIX}/etc/netdata" - deletedir "${NETDATA_PREFIX}/usr/share/netdata" - deletedir "${NETDATA_PREFIX}/usr/libexec/netdata" - deletedir "${NETDATA_PREFIX}/var/lib/netdata" - deletedir "${NETDATA_PREFIX}/var/cache/netdata" - deletedir "${NETDATA_PREFIX}/var/log/netdata" - fi +else + # installation prefix was NOT given - if [ -f /etc/logrotate.d/netdata ] + if [ -f "${NETDATA_PREFIX}/usr/sbin/netdata" ] then - echo "Deleting /etc/logrotate.d/netdata ..." - rm -i /etc/logrotate.d/netdata + echo "Deleting ${NETDATA_PREFIX}/usr/sbin/netdata ..." + rm -i "${NETDATA_PREFIX}/usr/sbin/netdata" fi - if [ -f /etc/systemd/system/netdata.service ] - then - echo "Deleting /etc/systemd/system/netdata.service ..." - rm -i /etc/systemd/system/netdata.service - fi + deletedir "${NETDATA_PREFIX}/etc/netdata" + deletedir "${NETDATA_PREFIX}/usr/share/netdata" + deletedir "${NETDATA_PREFIX}/usr/libexec/netdata" + deletedir "${NETDATA_PREFIX}/var/lib/netdata" + deletedir "${NETDATA_PREFIX}/var/cache/netdata" + deletedir "${NETDATA_PREFIX}/var/log/netdata" +fi - getent passwd netdata > /dev/null - if [ $? -eq 0 ] - then - echo - echo "You may also want to remove the user netdata" - echo "by running:" - echo " userdel netdata" - fi +if [ -f /etc/logrotate.d/netdata ] + then + echo "Deleting /etc/logrotate.d/netdata ..." + rm -i /etc/logrotate.d/netdata +fi - getent group netdata > /dev/null - if [ $? -eq 0 ] - then - echo - echo "You may also want to remove the group netdata" - echo "by running:" - echo " groupdel netdata" - fi +if [ -f /etc/systemd/system/netdata.service ] + then + echo "Deleting /etc/systemd/system/netdata.service ..." + rm -i /etc/systemd/system/netdata.service +fi - getent group docker > /dev/null - if [ $? -eq 0 -a "${NETDATA_ADDED_TO_DOCKER}" = "1" ] - then - echo - echo "You may also want to remove the netdata user from the docker group" - echo "by running:" - echo " gpasswd -d netdata docker" - fi +getent passwd netdata > /dev/null +if [ $? -eq 0 ] + then + echo + echo "You may also want to remove the user netdata" + echo "by running:" + echo " userdel netdata" +fi + +getent group netdata > /dev/null +if [ $? -eq 0 ] + then + echo + echo "You may also want to remove the group netdata" + echo "by running:" + echo " groupdel netdata" +fi + +getent group docker > /dev/null +if [ $? -eq 0 -a "${NETDATA_ADDED_TO_DOCKER}" = "1" ] + then + echo + echo "You may also want to remove the netdata user from the docker group" + echo "by running:" + echo " gpasswd -d netdata docker" +fi UNINSTALL chmod 750 netdata-uninstaller.sh # ----------------------------------------------------------------------------- -cat <<-END +cat <&2 "Uninstall script generated: ./netdata-uninstaller.sh"