app-misc/carbon-c-relay: revbump 3.1 to fix pidfile creation permission issues on...
authorFabian Groffen <grobian@gentoo.org>
Sun, 30 Apr 2017 08:06:55 +0000 (10:06 +0200)
committerFabian Groffen <grobian@gentoo.org>
Sun, 30 Apr 2017 08:08:06 +0000 (10:08 +0200)
Package-Manager: Portage-2.3.3, Repoman-2.3.1

app-misc/carbon-c-relay/carbon-c-relay-3.1-r1.ebuild [moved from app-misc/carbon-c-relay/carbon-c-relay-3.1.ebuild with 100% similarity]
app-misc/carbon-c-relay/files/carbon-c-relay.confd-r1
app-misc/carbon-c-relay/files/carbon-c-relay.initd-r1

index 64e4ab5c832ec0143cb076ae58e18afd78876ca7..5233eec2d2a19c6fd3f6afaf8ad6be46fcd4f73d 100644 (file)
@@ -4,9 +4,6 @@
 # routing file to read
 #ROUTES_FILE=/etc/carbon-c-relay.conf
 
-# where to store the PID-file
-#PIDFILE=/run/carbon-c-relay.pid
-
 # where to store the logfile
 #LOGFILE=/var/log/carbon-c-relay.log
 
index 104a7e0878e969b32bcf48ef1df79b02d97ccfb1..1e2734941cc163653ad21e1322944d333a72acac 100644 (file)
@@ -13,7 +13,7 @@ routes_config=${ROUTES_FILE:-/etc/${SVCNAME}.conf}
 
 command="/usr/bin/carbon-c-relay"
 command_args="-f ${routes_config} ${EXTRA_OPTS}"
-pidfile=${PIDFILE:-/run/${SVCNAME}.pid}
+pidfile="/run/carbon-c-relay/${SVCNAME}.pid"
 logfile=${LOGFILE:-/var/log/${SVCNAME}.log}
 user=${USER:-carbon}
 group=${GROUP:-carbon}
@@ -28,7 +28,8 @@ start_pre() {
                configtest || return 1
        fi
        touch "${logfile}"
-       chown ${user}:${group} "${logfile}"
+       mkdir -p "${pidfile%/*}"
+       chown ${user}:${group} "${logfile}" "${pidfile%/*}"
 }
 
 stop_pre() {
@@ -52,7 +53,10 @@ start() {
 
 stop() {
        ebegin "Stopping ${SVCNAME}"
-       start-stop-daemon --stop --exec ${command} --pidfile "${pidfile}"
+       # migration path
+       local pfile=${pidfile}
+       [[ -e /run/carbon-c-relay.pid ]] && pfile="/run/carbon-c-relay.pid"
+       start-stop-daemon --stop --exec ${command} --pidfile "${pfile}"
        eend $?
 }