From d96072f0de6641b564371191e3377a2721de31ec Mon Sep 17 00:00:00 2001 From: Stefan Walter Date: Fri, 24 Oct 2008 10:14:05 +0000 Subject: - Added rc.subr integration and removed references to etc/rc.d/qpage.sh - Added OPTIONS knob for enabling srvrsnpp.c patch from ports/123437 (felt it was better to make the patch optional) - Added more knobs for compile-time options: daemon user, syslog facility - Changed ${INSTALL_SCRIPT} to ${INSTALL_DATA} in post-install target - Removed old maintainer e-mail address from pkg-descr PR: 128318 Submitted by: maintainer --- comms/qpage/Makefile | 59 ++++++++++++++++++++---- comms/qpage/files/libwrap_ident_patch-srvrsnpp.c | 16 +++++++ comms/qpage/files/patch-config.input | 15 ++++-- comms/qpage/files/patch-ixo.c | 10 ++++ comms/qpage/files/qpage.in | 56 ++++++++++++++++++++++ comms/qpage/files/qpage.sh | 20 -------- comms/qpage/pkg-descr | 3 -- comms/qpage/pkg-plist | 1 - 8 files changed, 144 insertions(+), 36 deletions(-) create mode 100644 comms/qpage/files/libwrap_ident_patch-srvrsnpp.c create mode 100644 comms/qpage/files/patch-ixo.c create mode 100644 comms/qpage/files/qpage.in delete mode 100644 comms/qpage/files/qpage.sh (limited to 'comms') diff --git a/comms/qpage/Makefile b/comms/qpage/Makefile index d08258a0c56d..45b141083d43 100644 --- a/comms/qpage/Makefile +++ b/comms/qpage/Makefile @@ -7,7 +7,7 @@ PORTNAME= qpage PORTVERSION= 3.3 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= comms MASTER_SITES= http://www.qpage.org/download/ EXTRACT_SUFX= .tar.Z @@ -15,29 +15,70 @@ EXTRACT_SUFX= .tar.Z MAINTAINER= jfb@mr-happy.com COMMENT= SNPP client/server for sending messages to an alphanumeric pager +USE_RC_SUBR= qpage GNU_CONFIGURE= yes MAN1= qpage.1 +OPTIONS= IDENT_PATCH "Patch to disable libwrap ident lookups" off + +.include + +.if defined(WITH_IDENT_PATCH) +EXTRA_PATCHES=${FILESDIR}/libwrap_ident_patch-srvrsnpp.c +.endif + +.if !defined(WITH_QPAGE_SYSLOG_FACILITY) || !defined(WITH_QPAGE_USER) +.if !defined(WITH_QPAGE_SYSLOG_FACILITY) && !defined(WITH_QPAGE_USER) +_QPAGE_MSG= You may set the following configuration options: +.else +_QPAGE_MSG= The following additional configuration options are available: +.endif +.if !defined(WITH_QPAGE_SYSLOG_FACILITY) +WITH_QPAGE_SYSLOG_FACILITY= LOG_DAEMON +_QPAGE_SYSLOG_MSG=1 +.endif +.if !defined(WITH_QPAGE_USER) +WITH_QPAGE_USER= uucp +_QPAGE_USER_MSG=1 +.endif +pre-patch: + @${ECHO_MSG} "" + @${ECHO_MSG} ${_QPAGE_MSG} + @if [ -n "${_QPAGE_SYSLOG_MSG}" ]; then \ + ${ECHO_MSG} ""; \ + ${ECHO_MSG} " WITH_QPAGE_SYSLOG_FACILITY=syslog_facility"; \ + ${ECHO_MSG} " Default is LOG_DAEMON"; \ + fi + @if [ -n "${_QPAGE_USER_MSG}" ]; then \ + ${ECHO_MSG} ""; \ + ${ECHO_MSG} " WITH_QPAGE_USER=userid"; \ + ${ECHO_MSG} " Default is \"uucp\"; recommended that user be in group \"dialer\""; \ + fi + @${ECHO_MSG} "" + @${ECHO_MSG} "Press ^C now to stop the build and set make options." + @${ECHO_MSG} "You may find it necessary to 'make clean' before restarting the build." + @sleep 2 +.endif + post-patch: ${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \ ${WRKSRC}/qpage.man \ ${WRKSRC}/config.input \ ${WRKSRC}/config.h.in + ${REINPLACE_CMD} \ + -e 's,%%WITH_QPAGE_SYSLOG_FACILITY%%,${WITH_QPAGE_SYSLOG_FACILITY},' \ + -e 's,%%WITH_QPAGE_USER%%,${WITH_QPAGE_USER},' \ + ${WRKSRC}/config.input post-install: - @if [ ! -f ${PREFIX}/etc/rc.d/qpage.sh ]; then \ - ${ECHO_MSG} "Install ${PREFIX}/etc/rc.d/qpage.sh startup file."; \ - ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/qpage.sh \ - ${PREFIX}/etc/rc.d/qpage.sh; \ - fi @if [ ! -f ${PREFIX}/etc/qpage-example.cf ]; then \ ${ECHO_MSG} "Install ${PREFIX}/etc/qpage-example.cf file."; \ - ${INSTALL_SCRIPT} -m 640 ${WRKDIR}/${PORTNAME}-${PORTVERSION}/example.cf \ + ${INSTALL_DATA} -m 640 ${WRKDIR}/${PORTNAME}-${PORTVERSION}/example.cf \ ${PREFIX}/etc/qpage-example.cf; \ fi ${MKDIR} /var/spool/${PORTNAME} - ${CHOWN} uucp:dialer /var/spool/${PORTNAME} + ${CHOWN} ${WITH_QPAGE_USER}:dialer /var/spool/${PORTNAME} ${CHMOD} 0775 /var/spool/${PORTNAME} -.include +.include diff --git a/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c b/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c new file mode 100644 index 000000000000..8cd51a09b2f7 --- /dev/null +++ b/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c @@ -0,0 +1,16 @@ +--- srvrsnpp.c.orig 2008-10-20 10:30:57.539127452 -0400 ++++ srvrsnpp.c 2008-10-20 10:35:43.096529509 -0400 +@@ -1066,7 +1066,12 @@ + + fromhost(&request); + +- ptr = eval_user(&request); ++ /* ++ ** If we aren't doing an ident request, don't ask ++ ** TCP Wrappers to do it either ++ */ ++ if (IdentTimeout) ptr = eval_user(&request); ++ else ptr = NULL; + + if (ptr && strcmp(ptr, STRING_UNKNOWN) != 0) + p->ident = strdup(ptr); diff --git a/comms/qpage/files/patch-config.input b/comms/qpage/files/patch-config.input index fb47644040ac..ff8439da6b85 100644 --- a/comms/qpage/files/patch-config.input +++ b/comms/qpage/files/patch-config.input @@ -1,5 +1,5 @@ ---- config.input.orig Thu Nov 5 07:05:36 1998 -+++ config.input Mon May 17 23:14:53 2004 +--- config.input.orig 1998-11-05 01:05:36.000000000 -0500 ++++ config.input 2008-10-19 14:08:35.109933521 -0400 @@ -20,7 +20,7 @@ # See the QuickPage documentation for complete details about # the syntax of the configuration file. @@ -23,7 +23,16 @@ # assigned to that user. # -DAEMON_USER="daemon" -+DAEMON_USER="uucp" ++DAEMON_USER="%%WITH_QPAGE_USER%%" + + + # +@@ -59,7 +59,7 @@ + # used by QuickPage to log messages. See the syslog + # documentation (i.e. "man syslog") for more information. + # +-SYSLOG_FACILITY=LOG_DAEMON ++SYSLOG_FACILITY=%%WITH_QPAGE_SYSLOG_FACILITY%% # diff --git a/comms/qpage/files/patch-ixo.c b/comms/qpage/files/patch-ixo.c new file mode 100644 index 000000000000..83b48beedcba --- /dev/null +++ b/comms/qpage/files/patch-ixo.c @@ -0,0 +1,10 @@ +--- ixo.c.orig 1999-01-01 20:59:33.000000000 -0500 ++++ ixo.c 2008-10-20 00:10:55.367858145 -0400 +@@ -368,7 +368,6 @@ + if (tcsetattr(fd, TCSANOW, &ti) < 0) { + qpage_log(LOG_DEBUG, "tcsetattr(): %s", strerror(errno)); + closemodem(fd); +- return; + } + + /* diff --git a/comms/qpage/files/qpage.in b/comms/qpage/files/qpage.in new file mode 100644 index 000000000000..9d9800d70fa3 --- /dev/null +++ b/comms/qpage/files/qpage.in @@ -0,0 +1,56 @@ +#!/bin/sh + +# PROVIDE: qpage +# REQUIRE: NETWORKING +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable/configure this service: +# +# qpage_enable (bool): Set to NO by default. +# Set it to YES to enable qpage. +# qpage_queue_interval (int): Set to 10 (seconds) by default. +# qpage_cfg_file (path): Set it to an alternate configuration file path +# if desired. +# qpage_flags (str): Set it to a list of additional command-line +# parameters if desired. +# + +. %%RC_SUBR%% + +name="qpage" +rcvar=${name}_enable + +command=%%PREFIX%%/bin/${name} + +load_rc_config $name + +: ${qpage_enable="NO"} +: ${qpage_queue_interval="10"} +: ${qpage_cfg_file=""} +: ${qpage_flags=""} + +stop_cmd=${name}_stop +extra_commands="reload" +reload_cmd=${name}_reload + +command_args="-q ${qpage_queue_interval} ${qpage_flags}" +if [ -n "${qpage_cfg_file}" ]; then + command_args="${command_args} -C ${qpage_cfg_file}" +fi + +qpage_stop() { + /usr/bin/killall qpage +} + +qpage_reload() { + # awk pattern matches master daemon process only (PPID 1 in 3rd column) + pid=`/bin/ps alcxww | /usr/bin/awk "/^ *[0-9]+ +[0-9]+ +1 .* ${name}\$/{print \\\$2}"` + + if [ -n "$pid" ]; then + kill -HUP $pid + else + echo "$0: no qpage daemon found" >& 2 + fi +} + +run_rc_command "$1" diff --git a/comms/qpage/files/qpage.sh b/comms/qpage/files/qpage.sh deleted file mode 100644 index a183fa095842..000000000000 --- a/comms/qpage/files/qpage.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -case "$1" in -start) - [ -x ${PREFIX}/bin/qpage ] && ${PREFIX}/bin/qpage -q10 && echo -n ' qpage' - ;; -stop) - killall qpage && echo -n ' qpage' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac - -exit 0 diff --git a/comms/qpage/pkg-descr b/comms/qpage/pkg-descr index e35ddc6bd6d5..d960681c80a0 100644 --- a/comms/qpage/pkg-descr +++ b/comms/qpage/pkg-descr @@ -9,6 +9,3 @@ messages indicating the success or failure of a page are sent via e-mail to submitters of high-priority (level 0) pages. WWW: http://www.qpage.org/ - -Joe Stein -joes@seaport.net diff --git a/comms/qpage/pkg-plist b/comms/qpage/pkg-plist index 6550af9a7d91..7a1218d2315b 100644 --- a/comms/qpage/pkg-plist +++ b/comms/qpage/pkg-plist @@ -1,5 +1,4 @@ bin/qpage etc/qpage-example.cf -etc/rc.d/qpage.sh @exec if [ ! -d /var/spool/qpage ]; then mkdir /var/spool/qpage; chown uucp:dialer /var/spool/qpage; chmod 0775 /var/spool/qpage; fi @unexec if [ -d /var/spool/qpage ]; then rm -rf /var/spool/qpage; fi -- cgit v1.2.3