From 1545d13fa0dbea23b1c2dbe057dc773d4e56f646 Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Fri, 3 Jan 2020 17:11:43 -0500 Subject: [PATCH] Variable expansion related cleanup for man pages and sysv init --- etc/dkimpy-milter.conf | 9 ++++----- etc/dkimpy-milter.conf.in | 9 ++++----- system/dkimpy-milter | 6 ++---- system/dkimpy-milter.in | 16 +++++++++------- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/etc/dkimpy-milter.conf b/etc/dkimpy-milter.conf index 9cbb5a1..d82384e 100644 --- a/etc/dkimpy-milter.conf +++ b/etc/dkimpy-milter.conf @@ -1,6 +1,5 @@ # This is a basic configuration that can easily be adapted to suit a standard -# installation. For more advanced options, see dkimpy-milter.conf(5) and/or -# /usr/share/doc/dkimpy-milter/examples/opendkim.conf.sample. +# installation. For more advanced options, see dkimpy-milter.conf(5). # Log to syslog Syslog yes @@ -12,15 +11,13 @@ UMask 007 # Sign for example.com with key in /usr/local/etc/dkimkeys/dkim.key using # selector '2007' (e.g. 2007._domainkey.example.com) #Domain example.com -#KeyFile /usr/local/etc/mail/dkim.key +#KeyFile /usr/local/etc/mail/dkim.key #Selector default # Commonly-used options; the commented-out versions show the defaults. #Canonicalization relaxed/simple #Mode sv -# Socket local:/run/dkimpy-milter/dkimpy-milter.sock -# # ## Socket socketspec # ## # ## Names the socket where this filter should listen for milter connections @@ -30,6 +27,8 @@ UMask 007 # ## inet:port to listen on all interfaces # ## local:/path/to/socket to listen on a UNIX domain socket # +#Socket local:/run/dkimpy-milter/dkimpy-milter.sock +# #Socket inet:8892@localhost ## PidFile filename diff --git a/etc/dkimpy-milter.conf.in b/etc/dkimpy-milter.conf.in index 35ed752..046be08 100644 --- a/etc/dkimpy-milter.conf.in +++ b/etc/dkimpy-milter.conf.in @@ -1,6 +1,5 @@ # This is a basic configuration that can easily be adapted to suit a standard -# installation. For more advanced options, see dkimpy-milter.conf(5) and/or -# /usr/share/doc/dkimpy-milter/examples/opendkim.conf.sample. +# installation. For more advanced options, see dkimpy-milter.conf(5). # Log to syslog Syslog yes @@ -12,15 +11,13 @@ UMask 007 # Sign for example.com with key in @SYSCONFDIR@/dkimkeys/dkim.key using # selector '2007' (e.g. 2007._domainkey.example.com) #Domain example.com -#KeyFile @SYSCONFDIR@/mail/dkim.key +#KeyFile @SYSCONFDIR@/mail/dkim.key #Selector default # Commonly-used options; the commented-out versions show the defaults. #Canonicalization relaxed/simple #Mode sv -# Socket local:@RUNSTATEDIR@/dkimpy-milter.sock -# # ## Socket socketspec # ## # ## Names the socket where this filter should listen for milter connections @@ -30,6 +27,8 @@ UMask 007 # ## inet:port to listen on all interfaces # ## local:/path/to/socket to listen on a UNIX domain socket # +#Socket local:@RUNSTATEDIR@/dkimpy-milter.sock +# #Socket inet:8892@localhost ## PidFile filename diff --git a/system/dkimpy-milter b/system/dkimpy-milter index 9770675..3b938d1 100644 --- a/system/dkimpy-milter +++ b/system/dkimpy-milter @@ -18,10 +18,8 @@ # Short-Description: dkimpy-milter # Description: Python DKIM Milter for Sendmail and Postfix ### END INIT INFO -prefix="/usr/local" -exec_prefix=${prefix} -sysconfdir="/usr/local/etc" -bindir="${exec_prefix}/bin/" +sysconfdir="/usr/local/etc/dkimpy-milter" +bindir="/usr/local/bin" RUNDIR="/run/dkimpy-milter" DAEMON=${bindir}/dkimpy-milter PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin: diff --git a/system/dkimpy-milter.in b/system/dkimpy-milter.in index 90a6666..bff5ac2 100644 --- a/system/dkimpy-milter.in +++ b/system/dkimpy-milter.in @@ -33,8 +33,8 @@ test -x $DAEMON || exit 0 # Include dkimpy-python defaults if available # Typically not used -if [ -f @SYSCONFDIR@/default/dkimpy-milter ] ; then - . @SYSCONFDIR@/default/dkimpy-milter +if [ -f $sysconfdir/default/dkimpy-milter ] ; then + . $sysconfdir/default/dkimpy-milter fi set -e @@ -65,14 +65,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 +85,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 +94,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 +102,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 +113,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." ;;