diff options
Diffstat (limited to 'net-analyzer/netdata/files/netdata-1.8.0-openrc-fixes.patch')
-rw-r--r-- | net-analyzer/netdata/files/netdata-1.8.0-openrc-fixes.patch | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/net-analyzer/netdata/files/netdata-1.8.0-openrc-fixes.patch b/net-analyzer/netdata/files/netdata-1.8.0-openrc-fixes.patch new file mode 100644 index 000000000000..517eaec51faf --- /dev/null +++ b/net-analyzer/netdata/files/netdata-1.8.0-openrc-fixes.patch @@ -0,0 +1,105 @@ +From 3f4db620484e777265a7e5f0cfe10ba840f7eefd Mon Sep 17 00:00:00 2001 +From: Craig Andrews <candrews@integralblue.com> +Date: Tue, 3 Oct 2017 10:52:02 -0400 +Subject: [PATCH 1/3] Eliminate bashisms in openrc script + +--- + system/netdata-openrc.in | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/system/netdata-openrc.in b/system/netdata-openrc.in +index 465e1232c..5c4eafa57 100644 +--- a/system/netdata-openrc.in ++++ b/system/netdata-openrc.in +@@ -38,13 +38,13 @@ depend() { + } + + start_post() { +- if [[ ! -f @sysconfdir_POST@/netdata/netdata.conf ]]; then ++ if [ ! -f @sysconfdir_POST@/netdata/netdata.conf ]; then + ebegin "Downloading default configuration to @sysconfdir_POST@/netdata/netdata.conf" + sleep 2 + curl -s -o @sysconfdir_POST@/netdata/netdata.conf.new "${NETDATA_CONFIG_URL}" + ret=$? +- if [[ $ret -eq 0 && -s @sysconfdir_POST@/netdata/netdata.conf.new ]]; then +- mv @sysconfdir_POST@/netdata/netdata.conf{.new,} ++ if [ $ret -eq 0 && -s @sysconfdir_POST@/netdata/netdata.conf.new ]; then ++ mv @sysconfdir_POST@/netdata/netdata.conf.new @sysconfdir_POST@/netdata/netdata.conf + else + ret=1 + rm @sysconfdir_POST@/netdata/netdata.conf.new 2>/dev/null +@@ -57,20 +57,20 @@ stop_post() { + local result ret=0 count=0 sigkill=0 + + ebegin "Waiting for netdata to save its database" +- while [[ -f "${pidfile}" ]]; do +- if [[ $count -gt ${NETDATA_WAIT_EXIT_TIMEOUT} ]]; then ++ while [ -f "${pidfile}" ]; do ++ if [ $count -gt ${NETDATA_WAIT_EXIT_TIMEOUT} ]; then + sigkill=1 + break + fi + +- count=$[count + 1] ++ count=$((count + 1)) + kill -0 $(cat ${pidfile}) 2>/dev/null + ret=$? + test $ret -eq 0 && sleep 1 + done + eend $sigkill + +- if [[ $sigkill -eq 1 && -f "${pidfile}" ]]; then ++ if [ $sigkill -eq 1 && -f "${pidfile}" ]; then + ebegin "Netdata is taking too long to exit, forcing it to quit" + kill -SIGKILL $(cat ${pidfile}) 2>/dev/null + eend $? + +From b6d80fb3a3ae60077cbbc1e8dd0d01e1eb3ff67d Mon Sep 17 00:00:00 2001 +From: Craig Andrews <candrews@integralblue.com> +Date: Tue, 3 Oct 2017 14:56:53 -0400 +Subject: [PATCH 2/3] Fix the path to the netdata executable in the openrc + script + +Fixes #2826 +--- + system/netdata-openrc.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/system/netdata-openrc.in b/system/netdata-openrc.in +index 5c4eafa57..512d48278 100644 +--- a/system/netdata-openrc.in ++++ b/system/netdata-openrc.in +@@ -23,7 +23,7 @@ + + extra_started_commands="getconf" + pidfile="/run/netdata.pid" +-command="${NETDATA_INSTALL_PATH}/usr/sbin/netdata" ++command="@sbindir_POST@/netdata" + command_background="yes" + command_args="-P ${pidfile} ${NETDATA_EXTRA_ARGS}" + # start_stop_daemon_args="-u ${NETDATA_OWNER}" + +From b5823e7865851c3cc2381c4fb45716f269a4e85f Mon Sep 17 00:00:00 2001 +From: Craig Andrews <candrews@integralblue.com> +Date: Tue, 3 Oct 2017 15:56:39 -0400 +Subject: [PATCH 3/3] Create the var/cache/netdata directory if it doesn't + already exist in the systemd script + +--- + system/netdata.service.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/system/netdata.service.in b/system/netdata.service.in +index 1d4af988a..58cdff225 100644 +--- a/system/netdata.service.in ++++ b/system/netdata.service.in +@@ -9,6 +9,9 @@ Group=netdata + RuntimeDirectory=netdata + RuntimeDirectoryMode=0775 + ExecStart=@sbindir_POST@/netdata -P /run/netdata/netdata.pid -D ++ExecStartPre=/bin/mkdir -p @localstatedir_POST@/cache/netdata ++ExecStartPre=/bin/chown -R netdata:netdata @localstatedir_POST@/cache/netdata ++PermissionsStartOnly=true + + # saving a big db on slow disks may need some time + TimeoutStopSec=60 |