summaryrefslogtreecommitdiffstats
path: root/makeself/install-or-update.sh
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-03-28 03:43:43 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-03-28 03:43:43 +0300
commit89356ea031f5f0fcb832883c0f365248b060807c (patch)
treebb071594fee03764adf38cacf8064ca5cd742ff7 /makeself/install-or-update.sh
parentf727ae0a23017c728eb80ff62dcfd6e1636e218d (diff)
add files for fix installation
Diffstat (limited to 'makeself/install-or-update.sh')
-rw-r--r--makeself/install-or-update.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/makeself/install-or-update.sh b/makeself/install-or-update.sh
new file mode 100644
index 0000000000..114d42ff61
--- /dev/null
+++ b/makeself/install-or-update.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+. $(dirname "${0}")/functions.sh
+
+progress "Add user netdata to required user groups"
+
+NETDATA_ADDED_TO_DOCKER=0
+NETDATA_ADDED_TO_NGINX=0
+NETDATA_ADDED_TO_VARNISH=0
+NETDATA_ADDED_TO_HAPROXY=0
+NETDATA_ADDED_TO_ADM=0
+NETDATA_ADDED_TO_NSD=0
+if [ ${UID} -eq 0 ]
+ then
+ portable_add_group netdata
+ portable_add_user netdata
+ portable_add_user_to_group docker netdata && NETDATA_ADDED_TO_DOCKER=1
+ portable_add_user_to_group nginx netdata && NETDATA_ADDED_TO_NGINX=1
+ 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
+ portable_add_user_to_group nsd netdata && NETDATA_ADDED_TO_NSD=1
+ run_ok
+else
+ run_failed "The installer does not run as root."
+fi
+
+# -----------------------------------------------------------------------------
+progress "Install logrotate configuration for netdata"
+
+if [ ${UID} -eq 0 ]
+ then
+ if [ -d /etc/logrotate.d -a ! -f /etc/logrotate.d/netdata ]
+ then
+ run cp system/netdata.logrotate /etc/logrotate.d/netdata
+ fi
+
+ if [ -f /etc/logrotate.d/netdata ]
+ then
+ run chmod 644 /etc/logrotate.d/netdata
+ fi
+fi
+
+# -----------------------------------------------------------------------------
+progress "Install netdata at system init"
+
+if [ "${UID}" -eq 0 ]
+ then
+ install_netdata_service
+fi
+
+