Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2008 16:45:59 GMT
From:      Jeff Blank <jfb@mr-happy.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/128318: comms/qpage general updates
Message-ID:  <200810231645.m9NGjxB4091746@www.freebsd.org>
Resent-Message-ID: <200810231650.m9NGo1Ym070281@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         128318
>Category:       ports
>Synopsis:       comms/qpage general updates
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 23 16:50:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Jeff Blank
>Release:        6.3-REL, 7.0-REL, 7.1-PRERELEASE
>Organization:
>Environment:
>Description:
This PR addresses a number of issues I've had with the qpage port for some time (rc.subr, ability to set some compile-time options) and also incorporates the patches from PR ports/123437. I filed this separate PR to avoid overloading the limited scope of ports/123437, but this patch encompasses that PR for ease of diffing/patching/committing. I hope this is not a problem. PR ports/123437 may be closed, and I'll follow up with the submitter.

Please also note that the patch removes all lines from files/qpage.sh.  The file should be removed/sent to the attic/... if that is not an automatic action on a zero-byte file.

Files modified/added/removed
----------------------------
Makefile
pkg-descr
pkg-plist
files/libwrap_ident_patch-srvrsnpp.c
files/patch-config.input
files/patch-ixo.c
files/qpage.in
files/qpage.sh


Summary of changes
------------------
Makefile:
- 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


pkg-descr:
- Removed old maintainer e-mail address


pkg-plist:
- Removed etc/rc.d/qpage.sh entry (rc.subr integration)


files/:
- Removed qpage.sh and added qpage.in (rc.subr integration)
- Modified patch-config.input to integrate with Makefile knobs for daemon user and syslog facility
- Added patch-ixo.c and libwrap_ident_patch-srvrsnpp.c (ports/123437)
>How-To-Repeat:

>Fix:
Please patch comms/qpage port skeleton with attached diff.

Patch attached with submission follows:

===> Generating patch
===> Viewing diff with less
diff -ruN --exclude=CVS /usr/ports/comms/qpage.orig/Makefile /usr/ports/comms/qpage/Makefile
--- /usr/ports/comms/qpage.orig/Makefile	2008-10-19 04:09:01.000000000 -0400
+++ /usr/ports/comms/qpage/Makefile	2008-10-22 09:50:32.726268948 -0400
@@ -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 @@
 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 <bsd.port.pre.mk>
+
+.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 <bsd.port.mk>
+.include <bsd.port.post.mk>
diff -ruN --exclude=CVS /usr/ports/comms/qpage.orig/files/libwrap_ident_patch-srvrsnpp.c /usr/ports/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c
--- /usr/ports/comms/qpage.orig/files/libwrap_ident_patch-srvrsnpp.c	1969-12-31 19:00:00.000000000 -0500
+++ /usr/ports/comms/qpage/files/libwrap_ident_patch-srvrsnpp.c	2008-10-22 09:50:32.728268925 -0400
@@ -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 -ruN --exclude=CVS /usr/ports/comms/qpage.orig/files/patch-config.input /usr/ports/comms/qpage/files/patch-config.input
--- /usr/ports/comms/qpage.orig/files/patch-config.input	2004-05-17 18:08:09.000000000 -0400
+++ /usr/ports/comms/qpage/files/patch-config.input	2008-10-22 09:50:32.729768618 -0400
@@ -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 -ruN --exclude=CVS /usr/ports/comms/qpage.orig/files/patch-ixo.c /usr/ports/comms/qpage/files/patch-ixo.c
--- /usr/ports/comms/qpage.orig/files/patch-ixo.c	1969-12-31 19:00:00.000000000 -0500
+++ /usr/ports/comms/qpage/files/patch-ixo.c	2008-10-22 09:50:32.729768618 -0400
@@ -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 -ruN --exclude=CVS /usr/ports/comms/qpage.orig/files/qpage.in /usr/ports/comms/qpage/files/qpage.in
--- /usr/ports/comms/qpage.orig/files/qpage.in	1969-12-31 19:00:00.000000000 -0500
+++ /usr/ports/comms/qpage/files/qpage.in	2008-10-22 09:50:32.731268550 -0400
@@ -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 -ruN --exclude=CVS /usr/ports/comms/qpage.orig/files/qpage.sh /usr/ports/comms/qpage/files/qpage.sh
--- /usr/ports/comms/qpage.orig/files/qpage.sh	2000-07-05 08:36:20.000000000 -0400
+++ /usr/ports/comms/qpage/files/qpage.sh	1969-12-31 19:00:00.000000000 -0500
@@ -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 -ruN --exclude=CVS /usr/ports/comms/qpage.orig/pkg-descr /usr/ports/comms/qpage/pkg-descr
--- /usr/ports/comms/qpage.orig/pkg-descr	2002-09-21 03:09:52.000000000 -0400
+++ /usr/ports/comms/qpage/pkg-descr	2008-10-22 09:50:32.731268550 -0400
@@ -9,6 +9,3 @@
 e-mail to submitters of high-priority (level 0) pages.
 
 WWW: http://www.qpage.org/
-
-Joe Stein
-joes@seaport.net
diff -ruN --exclude=CVS /usr/ports/comms/qpage.orig/pkg-plist /usr/ports/comms/qpage/pkg-plist
--- /usr/ports/comms/qpage.orig/pkg-plist	2004-05-17 18:08:09.000000000 -0400
+++ /usr/ports/comms/qpage/pkg-plist	2008-10-22 09:50:32.731268550 -0400
@@ -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
===> Done


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810231645.m9NGjxB4091746>