diff options
Diffstat (limited to 'makeself/install-or-update.sh')
-rwxr-xr-x | makeself/install-or-update.sh | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/makeself/install-or-update.sh b/makeself/install-or-update.sh index 34630cf1..eed2bc30 100755 --- a/makeself/install-or-update.sh +++ b/makeself/install-or-update.sh @@ -8,6 +8,21 @@ umask 002 # Be nice on production environments renice 19 $$ >/dev/null 2>/dev/null +# ----------------------------------------------------------------------------- + +STARTIT=1 + +while [ ! -z "${1}" ] +do + if [ "${1}" = "--dont-start-it" ] + then + STARTIT=0 + else + echo >&2 "Unknown option '${1}'. Ignoring it." + fi + shift +done + # ----------------------------------------------------------------------------- progress "Checking new configuration files" @@ -70,7 +85,7 @@ progress "Add user netdata to required user groups" NETDATA_USER="root" NETDATA_GROUP="root" -add_netdata_user_and_group +add_netdata_user_and_group "/opt/netdata" if [ $? -eq 0 ] then NETDATA_USER="netdata" @@ -81,6 +96,29 @@ fi # ----------------------------------------------------------------------------- +progress "Check SSL certificates paths" + +if [ ! -f "/etc/ssl/certs/ca-certificates.crt" ] +then + if [ ! -f /opt/netdata/.curlrc ] + then + cacert= + + # CentOS + [ -f "/etc/ssl/certs/ca-bundle.crt" ] && cacert="/etc/ssl/certs/ca-bundle.crt" + + if [ ! -z "${cacert}" ] + then + echo "Creating /opt/netdata/.curlrc with cacert=${cacert}" + echo >/opt/netdata/.curlrc "cacert=${cacert}" + else + run_failed "Failed to find /etc/ssl/certs/ca-certificates.crt" + fi + fi +fi + + +# ----------------------------------------------------------------------------- progress "Install logrotate configuration for netdata" install_netdata_logrotate || run_failed "Cannot install logrotate file for netdata." @@ -136,6 +174,7 @@ run chown -R ${NETDATA_USER}:${NETDATA_GROUP} /opt/netdata # ----------------------------------------------------------------------------- + progress "fix plugin permissions" for x in apps.plugin freeipmi.plugin cgroup-network @@ -156,14 +195,22 @@ then run chmod 4750 bin/fping fi + # ----------------------------------------------------------------------------- -progress "starting netdata" -restart_netdata "/opt/netdata/bin/netdata" -if [ $? -eq 0 ] - then - download_netdata_conf "${NETDATA_USER}:${NETDATA_GROUP}" "/opt/netdata/etc/netdata/netdata.conf" "http://localhost:19999/netdata.conf" - netdata_banner "is installed and running now!" +if [ ${STARTIT} -eq 1 ] +then + progress "starting netdata" + + restart_netdata "/opt/netdata/bin/netdata" + if [ $? -eq 0 ] + then + download_netdata_conf "${NETDATA_USER}:${NETDATA_GROUP}" "/opt/netdata/etc/netdata/netdata.conf" "http://localhost:19999/netdata.conf" + netdata_banner "is installed and running now!" + else + generate_netdata_conf "${NETDATA_USER}:${NETDATA_GROUP}" "/opt/netdata/etc/netdata/netdata.conf" "http://localhost:19999/netdata.conf" + netdata_banner "is installed now!" + fi else generate_netdata_conf "${NETDATA_USER}:${NETDATA_GROUP}" "/opt/netdata/etc/netdata/netdata.conf" "http://localhost:19999/netdata.conf" netdata_banner "is installed now!" |