check for apps.plugin only check it is installed
Costa Tsaousis (ktsaou) committed
Jan 20, 2018 at 18:38 UTC
9baa3818d83af14277801debde53bed39c7efd72
2 files changed
+43
-27
installer/functions.sh
+11
-1
@@ -506,10 +506,20 @@ install_netdata_service() {
506
507
if [ "${UID}" -eq 0 ]
508
then
509
- if [ "${uname}" = "FreeBSD" ]
509
+ if [ "${uname}" = "Darwin" ]
510
then
511
+
512
+ echo >&2 "hm... I don't know how to install a startup script for MacOS X"
513
+ return 1
514
+
515
+ elif [ "${uname}" = "FreeBSD" ]
516
+ then
517
+
518
run cp system/netdata-freebsd /etc/rc.d/netdata && \
519
+ NETDATA_START_CMD="service netdata start" && \
520
+ NETDATA_STOP_CMD="service netdata stop" && \
521
return 0
522
+
523
elif issystemd
524
then
525
# systemd is running on this system
netdata-installer.sh
+32
-26
@@ -767,34 +767,37 @@ if [ ${UID} -eq 0 ]
767
run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -a -name \*.plugin -exec chmod 0755 {} \;
768
run find "${NETDATA_PREFIX}/usr/libexec/netdata" -type f -a -name \*.sh -exec chmod 0755 {} \;
769
770
- setcap_ret=1
771
- if ! iscontainer
772
- then
773
- if [ ! -z "${setcap}" ]
770
+ if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" ]
771
+ then
772
+ setcap_ret=1
773
+ if ! iscontainer
774
then
775
- run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
776
- run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
777
- run setcap cap_dac_read_search,cap_sys_ptrace+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
778
- setcap_ret=$?
775
+ if [ ! -z "${setcap}" ]
776
+ then
777
+ run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
778
+ run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
779
+ run setcap cap_dac_read_search,cap_sys_ptrace+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
780
+ setcap_ret=$?
781
+ fi
782
+
783
+ if [ ${setcap_ret} -eq 0 ]
784
+ then
785
+ # if we managed to setcap
786
+ # but we fail to execute apps.plugin
787
+ # trigger setuid to root
788
+ "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" -t >/dev/null 2>&1
789
+ setcap_ret=$?
790
+ fi
791
fi
792
781
- if [ ${setcap_ret} -eq 0 ]
793
+ if [ ${setcap_ret} -ne 0 ]
794
then
783
- # if we managed to setcap
784
- # but we fail to execute apps.plugin
785
- # trigger setuid to root
786
- "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" -t >/dev/null 2>&1
787
- setcap_ret=$?
795
+ # fix apps.plugin to be setuid to root
796
+ run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
797
+ run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
798
fi
799
fi
800
791
- if [ ${setcap_ret} -ne 0 ]
792
- then
793
- # fix apps.plugin to be setuid to root
794
- run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
795
- run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin"
796
- fi
797
-
801
if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/freeipmi.plugin" ]
802
then
803
run chown root:${NETDATA_GROUP} "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/freeipmi.plugin"
@@ -929,12 +932,14 @@ https://github.com/firehol/netdata/wiki/Installation
932
VERMSG
933
fi
934
932
-# -----------------------------------------------------------------------------
933
-progress "Check apps.plugin"
935
+if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/apps.plugin" ]
936
+then
937
+ # -----------------------------------------------------------------------------
938
+ progress "Check apps.plugin"
939
935
-if [ "${UID}" -ne 0 ]
936
- then
937
- cat <<SETUID_WARNING
940
+ if [ "${UID}" -ne 0 ]
941
+ then
942
+ cat <<SETUID_WARNING
943
944
${TPUT_BOLD}apps.plugin needs privileges${TPUT_RESET}
945
@@ -958,6 +963,7 @@ running processes. It cannot be instructed from the netdata daemon to perform
963
any task, so it is pretty safe to do this.
964
965
SETUID_WARNING
966
+ fi
967
fi
968
969
# -----------------------------------------------------------------------------