From 4297b5dc680641b143a92413be734becc0e16000 Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Sat, 5 Oct 2019 21:40:21 -0400 Subject: [PATCH] XFix sysv init so it works (LP: #1839487) --- CHANGES | 1 + system/dkimpy-milter | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index ac466e7..466ced2 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ cause a traceback (LP: #1844161) - Catch more ascii encoding errors to improve resilience against bad data (LP: #1844189) + - Fix sysv init so it works (LP: #1839487) 1.1.0 2019-04-12 - Add SubDomains option to enable signing for sub-domains (LP: #1811535) diff --git a/system/dkimpy-milter b/system/dkimpy-milter index 5be4fb9..6c80fca 100644 --- a/system/dkimpy-milter +++ b/system/dkimpy-milter @@ -18,8 +18,10 @@ # Short-Description: dkimpy-milter # Description: Python DKIM Milter for Sendmail and Postfix ### END INIT INFO -sysconfdir="/usr/local/etc/dkimpy-milter" -bindir="/usr/local/bin" +prefix="/usr/local" +exec_prefix=${prefix} +sysconfdir="/usr/local/etc" +bindir="${exec_prefix}/bin/" RUNDIR="/run/dkimpy-milter" DAEMON=${bindir}/dkimpy-milter PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin: @@ -65,14 +67,14 @@ case "$1" in fi fi fi - - start-stop-daemon --start --quiet --pidfile $RUNDIR/$NAME.pid --startas \ - $DAEMON $sysconfdir/$NAME.conf --name $NAME --test > /dev/null \ + start-stop-daemon --start --background --quiet --pidfile \ + $RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf echo "$NAME." ;; stop) echo -n "Stopping $DESC: " if [ -f $RUNDIR/$NAME.pid ]; then + chown root:root $RUNDIR/$NAME.pid start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid rm $RUNDIR/$NAME.pid #echo $SOCKET @@ -85,6 +87,7 @@ case "$1" in force-reload) echo -n "Force reloading $DESC: " if [ -f $RUNDIR/$NAME.pid ]; then + chown root:root $RUNDIR/$NAME.pid start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid rm $RUNDIR/$NAME.pid #echo $SOCKET @@ -93,7 +96,7 @@ case "$1" in fi fi sleep 1 - start-stop-daemon --start --chuid $USER --background --quiet --pidfile \ + start-stop-daemon --start --background --quiet --pidfile \ $RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf echo "$NAME." ;; @@ -101,6 +104,7 @@ case "$1" in echo "Restarting $DESC: " echo -n "Stopping $DESC: " if [ -f $RUNDIR/$NAME.pid ]; then + chown root:root $RUNDIR/$NAME.pid start-stop-daemon --stop --pidfile $RUNDIR/$NAME.pid rm $RUNDIR/$NAME.pid #echo $SOCKET @@ -111,7 +115,7 @@ case "$1" in echo "$NAME." sleep 1 echo -n "Starting $DESC: " - start-stop-daemon --start --chuid $USER --background --quiet --pidfile \ + start-stop-daemon --start --background --quiet --pidfile \ $RUNDIR/$NAME.pid --exec $DAEMON $sysconfdir/$NAME.conf echo "$NAME." ;;