From f7331858fec88ed93ddfc2f69fc79f56f1052081 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 18 Jun 2009 23:13:16 +0300 Subject: [PATCH] Handle program name transformations in metaqueue.in * configure.ac (AC_OUTPUT): Remove misc/metaqueue - handled by misc/Makefile.am * misc/Makefile.am (metaqueue): New rule * misc/metaqueue.in (MAILQPROG, MAILQ): New variables. (list): Handle -V --- configure.ac | 2 +- misc/Makefile.am | 9 +++++++++ misc/metaqueue.in | 18 +++++++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index b3e460e..5a20073 100644 --- a/configure.ac +++ b/configure.ac @@ -472,6 +472,6 @@ AC_CONFIG_COMMANDS([sm.setup.sh], [chmod +x misc/sm.setup.sh]) AC_CONFIG_COMMANDS([mailq.sh], [chmod +x misc/mailq.sh]) AC_CONFIG_COMMANDS([qmgrctl.sh], [chmod +x misc/qmgrctl.sh]) dnl do not put statethreads here: it is configured by itself -AC_OUTPUT([Makefile include/Makefile librepl/Makefile libmta/Makefile libdns/Makefile libsmmap/Makefile libconf/Makefile libcdb/Makefile libibdb/Makefile libiqdb/Makefile libedb/Makefile libedbc/Makefile libactdb/Makefile libdadb/Makefile libthr/Makefile libevthr/Makefile libpmilter/Makefile smtps/Makefile smtpc/Makefile qmgr/Makefile smar/Makefile mcp/Makefile libcheck/Makefile checks/Makefile check2/Makefile chkmts/Makefile misc/Makefile perf/Makefile doc/Makefile man/Makefile contrib/Makefile misc/sm.setup.sh misc/sm.check.sh misc/mailq.sh misc/qmgrctl.sh misc/metaqueue], +AC_OUTPUT([Makefile include/Makefile librepl/Makefile libmta/Makefile libdns/Makefile libsmmap/Makefile libconf/Makefile libcdb/Makefile libibdb/Makefile libiqdb/Makefile libedb/Makefile libedbc/Makefile libactdb/Makefile libdadb/Makefile libthr/Makefile libevthr/Makefile libpmilter/Makefile smtps/Makefile smtpc/Makefile qmgr/Makefile smar/Makefile mcp/Makefile libcheck/Makefile checks/Makefile check2/Makefile chkmts/Makefile misc/Makefile perf/Makefile doc/Makefile man/Makefile contrib/Makefile misc/sm.setup.sh misc/sm.check.sh misc/mailq.sh misc/qmgrctl.sh], [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h.in]) # @end1 diff --git a/misc/Makefile.am b/misc/Makefile.am index 62d6666..c580d19 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -35,6 +35,15 @@ qmgrctl_LDADD = $(LDRCB) $(LDADD) $(LDMISC) $(LDREPL) metaconf_SOURCES= metaconf.c metaconf_LDADD = $(LDRCB) $(LDCONF) $(LDADD) $(LDMISC) $(LDREPL) +metaqueue: ${top_srcdir}/misc/metaqueue.in Makefile + sed -e 's,@''bindir''@,@bindir@,g' \ + -e '/^MAILQPROG=/{s/^MAILQPROG=//;$(transform);s/^/MAILQPROG=/}' ${top_srcdir}/misc/metaqueue.in > metaqueue.tmp + if cmp metaqueue.tmp metaqueue >/dev/null 2>&1; then \ + rm metaqueue.tmp; \ + else \ + mv metaqueue.tmp metaqueue; \ + fi + mailq_SOURCES = mailq.c mailq_LDADD = $(LDQMGR) $(LDACTDB) $(LDEDB) $(LDIBDB) $(LDCSTRR) $(LDRCB) $(LDADDR) $(LDCSTRR) $(LDMISCR) $(LDBDB) $(PTHREAD_LIBS) $(LDREPLR) mailq_CC =$(PTHREAD_CC) diff --git a/misc/metaqueue.in b/misc/metaqueue.in index 54cb51f..e3c2a85 100755 --- a/misc/metaqueue.in +++ b/misc/metaqueue.in @@ -4,14 +4,14 @@ # # $Id: metaqueue.in,v 1.1 2009/06/02 14:04:07 ca Exp $ +# will be replaced by configure +bindir=@bindir@ + # queue directory SMXQD=${SMXQDIR:-/var/spool/meta1} CONFIG=${MTACONFDIR:-/etc/meta1}/meta1.conf - -# will be replaced by configure -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ +MAILQPROG=mailq +MAILQ=${bindir}/$MAILQPROG VERBOSE= COMMAND= @@ -58,6 +58,7 @@ OPTIONS are: -M, --id REGEX print only entries whose ID matches REGEX -R, --rcpt REGEX print only entries whose address matches REGEX + -V, --verbose increase verbosity level EOT } @@ -70,6 +71,9 @@ list() { shift 2;; -[MR]*) CMDLINE="$CMDLINE $1" shift;; + -V|--verbose) + CMDLINE="$CMDLINE $1" + shift;; -h|--help) list_usage exit 0;; @@ -77,7 +81,7 @@ list() { esac done - eval ${bindir}/runas ${SMXQ} ${bindir}/mailq $VERBOSE $CMDLINE + eval ${bindir}/runas ${SMXQ} ${MAILQ} $VERBOSE $CMDLINE } ## @@ -264,7 +268,7 @@ manage() usage_error "communication socket not given" fi if [ -n $REGEX ]; then - ${bindir}/runas ${SMXQ} ${bindir}/mailq -VV | + ${bindir}/runas ${SMXQ} ${MAILQ} -VV | email_to_rcpt_id "$REGEX" $NOT $STATE | while read rcptid do -- 1.6.0.3