From ef90f616b05ef91942466f915f6b5ea0f07747db Mon Sep 17 00:00:00 2001
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Sat, 10 Jan 2004 08:48:29 +0000
Subject: Nitpicks for the comms/qpage port

	The comms/qpage port has a few minor problems.  A default installation gives
	the following errors when the /usr/local/etc/rc.d/qpage.sh script is
	execute:

	    qpage[68438]: cannot open /etc/qpage.cf: No such file or directory
	    qpage[68438]: cannot access LockDir(/var/spool/lock): Permission denied
	    qpage[68438]: cannot access QueueDir(/var/spool/qpage): No such file or directory
	    qpage[68438]: cannot chdir to QueueDir(/var/spool/qpage): No such file or directory

	In short:

	1) qpage looks for its configuration file in /etc instead of /usr/local/etc
	2) It setuid()'s to a user (daemon) without permission to access /var/spool/lock
	but does not document this anywhere outside of the source.
	3) It's queue directory is not created by installing the port.

PR:		ports/48059
Submitted by:	Kirk Strauser <kirk@strauser.com>
---
 comms/qpage/Makefile                 |  8 ++++++++
 comms/qpage/files/patch-config.h.in  | 11 +++++++++++
 comms/qpage/files/patch-config.input | 20 ++++++++++++++++++++
 comms/qpage/files/patch-qpage.man    | 11 +++++++++++
 4 files changed, 50 insertions(+)
 create mode 100644 comms/qpage/files/patch-config.h.in
 create mode 100644 comms/qpage/files/patch-config.input
 create mode 100644 comms/qpage/files/patch-qpage.man

diff --git a/comms/qpage/Makefile b/comms/qpage/Makefile
index 60922993b28c..f326a3f6cf23 100644
--- a/comms/qpage/Makefile
+++ b/comms/qpage/Makefile
@@ -7,6 +7,7 @@
 
 PORTNAME=	qpage
 PORTVERSION=	3.3
+PORTREVISION=	1
 CATEGORIES=	comms
 MASTER_SITES=	http://www.qpage.org/download/
 EXTRACT_SUFX=	.tar.Z
@@ -15,9 +16,16 @@ MAINTAINER=	ports@FreeBSD.org
 COMMENT=	SNPP client/server for sending messages to an alphanumeric pager
 
 GNU_CONFIGURE=	yes
+USE_REINPLACE=	yes
 
 MAN1=		qpage.1
 
+post-patch:
+	${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},g' \
+		${WRKSRC}/qpage.man \
+		${WRKSRC}/config.input \
+		${WRKSRC}/config.h.in
+
 post-install:
 	@if [ ! -f ${PREFIX}/etc/rc.d/qpage.sh ]; then \
 		${ECHO_MSG} "Install ${PREFIX}/etc/rc.d/qpage.sh startup file."; \
diff --git a/comms/qpage/files/patch-config.h.in b/comms/qpage/files/patch-config.h.in
new file mode 100644
index 000000000000..0ef2db19f858
--- /dev/null
+++ b/comms/qpage/files/patch-config.h.in
@@ -0,0 +1,11 @@
+--- config.h.in.orig	Sat Jan 10 00:42:55 2004
++++ config.h.in	Sat Jan 10 00:43:14 2004
+@@ -17,7 +17,7 @@
+ #undef SNPP_SERVER_FILE
+ 
+ /* Define as the location of the qpage configuration file.  */
+-#define QPAGE_CONFIG "/etc/qpage.cf"
++#define QPAGE_CONFIG "%%PREFIX%%/etc/qpage.cf"
+ 
+ /* Define as the location of the lock directory.  */
+ #undef DEFAULT_LOCKDIR
diff --git a/comms/qpage/files/patch-config.input b/comms/qpage/files/patch-config.input
new file mode 100644
index 000000000000..00e48e4a485f
--- /dev/null
+++ b/comms/qpage/files/patch-config.input
@@ -0,0 +1,20 @@
+--- config.input.orig	Sat Jan 10 00:43:26 2004
++++ config.input	Sat Jan 10 00:44:05 2004
+@@ -20,7 +20,7 @@
+ # See the QuickPage documentation for complete details about
+ # the syntax of the configuration file.
+ #
+-QPAGE_CONFIG="/etc/qpage.cf"
++QPAGE_CONFIG="%%PREFIX%%/etc/qpage.cf"
+ 
+ 
+ #
+@@ -41,7 +41,7 @@
+ # copies of the configuration file.  Only one filename
+ # may be specified.
+ #
+-SNPP_SERVER_FILE="/etc/qpage.servers"
++SNPP_SERVER_FILE="%%PREFIX%%/etc/qpage.servers"
+ 
+ 
+ #
diff --git a/comms/qpage/files/patch-qpage.man b/comms/qpage/files/patch-qpage.man
new file mode 100644
index 000000000000..19e11ba81a58
--- /dev/null
+++ b/comms/qpage/files/patch-qpage.man
@@ -0,0 +1,11 @@
+--- qpage.man.orig	Sat Jan 10 00:44:16 2004
++++ qpage.man	Sat Jan 10 00:44:47 2004
+@@ -867,7 +867,7 @@
+ must be able to detect when it's safe to send dial commands to the modem.
+ .LP
+ .SH FILES
+-/etc/qpage.cf
++%%PREFIX%%/etc/qpage.cf
+ .SH SEE ALSO
+ .B RFC-1861
+ .SH KNOWN BUGS
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0