pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail/qmail-run pkgsrc changes:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4449171242db
branches:  trunk
changeset: 365906:4449171242db
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Sun Jul 30 03:05:58 2017 +0000

description:
pkgsrc changes:

- Collapse redundant code for invoking service-specific rc.d scripts.
- Don't try to run a service's rc.d script if it isn't enabled in rc.conf.
- Run "pause" in reverse sequence, like "stop" does.
- Support "stat", "pause", and "cont" in qmailqread.

Bump version.

diffstat:

 mail/qmail-run/Makefile            |   4 +-
 mail/qmail-run/files/qmail.sh      |  47 ++++++++++++++++++-------------------
 mail/qmail-run/files/qmailqread.sh |  31 ++++++++++++++++++++++++-
 3 files changed, 55 insertions(+), 27 deletions(-)

diffs (147 lines):

diff -r 9de21a9e0c11 -r 4449171242db mail/qmail-run/Makefile
--- a/mail/qmail-run/Makefile   Sat Jul 29 22:51:11 2017 +0000
+++ b/mail/qmail-run/Makefile   Sun Jul 30 03:05:58 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.40 2017/07/21 04:08:15 schmonz Exp $
+# $NetBSD: Makefile,v 1.41 2017/07/30 03:05:58 schmonz Exp $
 #
 
-DISTNAME=              qmail-run-20170721
+DISTNAME=              qmail-run-20170729
 CATEGORIES=            mail
 MASTER_SITES=          # empty
 DISTFILES=             # empty
diff -r 9de21a9e0c11 -r 4449171242db mail/qmail-run/files/qmail.sh
--- a/mail/qmail-run/files/qmail.sh     Sat Jul 29 22:51:11 2017 +0000
+++ b/mail/qmail-run/files/qmail.sh     Sun Jul 30 03:05:58 2017 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: qmail.sh,v 1.5 2017/06/17 05:58:39 schmonz Exp $
+# $NetBSD: qmail.sh,v 1.6 2017/07/30 03:05:59 schmonz Exp $
 #
 # @PKGNAME@ master script for administrators to control qmail
 # services. Usage resembles the qmailctl script from "Life with qmail".
@@ -22,32 +22,31 @@
 #
 forward_commands()
 {
-       # Backward compat with NetBSD <1.6:
-       [ -z "$rc_arg" ] && rc_arg=$_arg
-
-       for file in $COMMAND_LIST; do
-               $rcd_dir/$file $rc_arg
-       done
+       qmailrcd $COMMAND_LIST
 }
 
 reverse_commands()
 {
+       REVCOMMAND_LIST=
+       for file in $COMMAND_LIST; do
+               REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
+       done
+
+       qmailrcd $REVCOMMAND_LIST
+}
+
+qmailrcd()
+{
        # Backward compat with NetBSD <1.6:
        [ -z "$rc_arg" ] && rc_arg=$_arg
 
-       REVCOMMAND_LIST=
-       for file in $COMMAND_LIST; do
-               REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
-       done
-       for file in $REVCOMMAND_LIST; do
-               $rcd_dir/$file $rc_arg
-       done
-}
-
-qmailrcd()
-{
-       for service in $@; do
-               $rcd_dir/qmail${service} $rc_arg
+       for service in "$@"; do
+               if [ -f /etc/rc.subr ]; then
+                       load_rc_config $service
+                       checkyesno $service && $rcd_dir/${service} $rc_arg
+               else
+                       $rcd_dir/${service} $rc_arg
+               fi
        done
 }
 
@@ -75,13 +74,13 @@
 name="qmail"
 start_cmd="forward_commands"
 stop_cmd="reverse_commands"
-doqueue_cmd="qmailrcd send"; alrm_cmd=${doqueue_cmd}; flush_cmd=${doqueue_cmd}
+doqueue_cmd="qmailrcd qmailsend"; alrm_cmd=${doqueue_cmd}; flush_cmd=${doqueue_cmd}
 reload_cmd="qmailrcd send"; hup_cmd=${reload_cmd}
 status_cmd="forward_commands"; stat_cmd=${status_cmd}
-pause_cmd="forward_commands"
+pause_cmd="reverse_commands"
 cont_cmd="forward_commands"
-cdb_cmd="qmailrcd smtpd ofmipd pop3d"
-queue_cmd="qmailrcd send"
+cdb_cmd="qmailrcd qmailsmtpd qmailofmipd qmailpop3d"
+queue_cmd="qmailrcd qmailsend"
 help_cmd="qmail_help"
 extra_commands="pause cont stat status cdb doqueue reload queue alrm flush hup help"
 
diff -r 9de21a9e0c11 -r 4449171242db mail/qmail-run/files/qmailqread.sh
--- a/mail/qmail-run/files/qmailqread.sh        Sat Jul 29 22:51:11 2017 +0000
+++ b/mail/qmail-run/files/qmailqread.sh        Sun Jul 30 03:05:58 2017 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: qmailqread.sh,v 1.11 2017/06/17 05:58:39 schmonz Exp $
+# $NetBSD: qmailqread.sh,v 1.12 2017/07/30 03:05:59 schmonz Exp $
 #
 # @PKGNAME@ script to control a service providing local non-root
 # users access to see the queue. Adapted from a script by Steinar Haug.
@@ -29,6 +29,10 @@
 command="${qmailqread_tcpserver}"
 procname=${name}
 start_precmd="qmailqread_precmd"
+extra_commands="stat pause cont"
+stat_cmd="qmailqread_stat"
+pause_cmd="qmailqread_pause"
+cont_cmd="qmailqread_cont"
 
 qmailqread_precmd()
 {
@@ -50,6 +54,31 @@
        rc_flags=""
 }
 
+qmailqread_stat()
+{
+       run_rc_command status
+}
+
+qmailqread_pause()
+{
+       if ! statusmsg=`run_rc_command status`; then
+               @ECHO@ $statusmsg
+               return 1
+       fi
+       @ECHO@ "Pausing ${name}."
+       kill -STOP $rc_pid
+}
+
+qmailqread_cont()
+{
+       if ! statusmsg=`run_rc_command status`; then
+               @ECHO@ $statusmsg
+               return 1
+       fi
+       @ECHO@ "Continuing ${name}."
+       kill -CONT $rc_pid
+}
+
 if [ -f /etc/rc.subr ]; then
        load_rc_config $name
        run_rc_command "$1"



Home | Main Index | Thread Index | Old Index