Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 May 2006 13:43:05 -0500 (EST)
From:      Wesley Shields <wxs@csh.rit.edu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/96720: [PATCH]: www/tinyproxy
Message-ID:  <200605031843.k43Ih5uM007061@syn.csh.rit.edu>
Resent-Message-ID: <200605031740.k43HeHN1079905@freefall.freebsd.org>

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

>Number:         96720
>Category:       ports
>Synopsis:       [PATCH]: www/tinyproxy
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 03 17:40:17 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Wesley Shields
>Release:        FreeBSD 6.0-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD syn 6.0-RELEASE-p2 FreeBSD 6.0-RELEASE-p2 #1: Wed Jan 11 11:57:33 EST 2006 root@syn:/usr/obj/usr/src/sys/GENERIC i386

>Description:
The attached patch for www/tinyproxy does the following:

- Now users an rcNG script.
- Removes the (now) un-necessary pkg-message.
- Moves the configuration file to ${PREFIX}/etc/tinyproxy.conf
- Sets myself as the maintainer.

I think a note in UPDATING is in order for these changes.  Something to
the effect of:

20060503:
  AFFECTS: users of www/tinyproxy
  AUTHOR: wxs@csh.rit.edu

  tinyproxy now installs a rcNG script.  To enable tinyproxy at boot
  time, set the following in rc.conf(5):

  tinyproxy_enable="YES"

	The confiration file for tinyproxy has been moved to
  ${PREFIX}/etc/tinyproxy.conf.  Any old configuration files will need
  to be migrated over to the new location.

>How-To-Repeat:
N/A

>Fix:

diff -ruN www/tinyproxy.orig/Makefile www/tinyproxy/Makefile
--- www/tinyproxy.orig/Makefile	Mon Jan 23 15:27:33 2006
+++ www/tinyproxy/Makefile	Wed May  3 10:05:15 2006
@@ -11,14 +11,15 @@
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	wxs@csh.rit.edu
 COMMENT=	A small, efficient HTTP proxy server
 
+USE_RC_SUBR=	tinyproxy.sh
 GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
 USE_REINPLACE=	yes
 CONFIGURE_ARGS=	--bindir=${PREFIX}/sbin \
-		--with-config=${PREFIX}/etc/tinyproxy/tinyproxy.conf \
+		--with-config=${PREFIX}/etc/tinyproxy.conf \
 		--program-transform-name=""
 
 MAN8=		tinyproxy.8
@@ -27,15 +28,16 @@
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|-O2||' ${WRKSRC}/configure
-	@${REINPLACE_CMD} -e 's|/\(etc/tinyproxy/tinyproxy.conf\)|${PREFIX}/\1|' \
+	@${REINPLACE_CMD} -e 's|/etc/tinyproxy/tinyproxy.conf|${PREFIX}/etc/tinyproxy.conf|' \
 	  ${WRKSRC}/doc/tinyproxy.8
 .if ${OSVERSION} < 500000
 	@${REINPLACE_CMD} -e 's|stdint.h|stdlib.h|' ${WRKSRC}/src/scanner.c
 .endif
 
 post-install:
-	@${SED} -e "s#%PREFIX%#${PREFIX}#" ${FILESDIR}/tinyproxy.sh > ${WRKDIR}/tinyproxy.sh
-	@${INSTALL_SCRIPT} ${WRKDIR}/tinyproxy.sh ${LOCALBASE}/etc/rc.d
-	@${SED} -e "s#/usr/local/#${LOCALBASE}/#" ${PKGMESSAGE}
+	@if [ ! -f ${PREFIX}/etc/tinyproxy.conf ]; then \
+		${CP} -p ${PREFIX}/etc/tinyproxy.conf-dist \
+		${PREFIX}/etc/tinyproxy.conf ; \
+	fi
 
 .include <bsd.port.post.mk>
diff -ruN www/tinyproxy.orig/files/tinyproxy.sh www/tinyproxy/files/tinyproxy.sh
--- www/tinyproxy.orig/files/tinyproxy.sh	Thu May  6 04:03:51 2004
+++ www/tinyproxy/files/tinyproxy.sh	Wed Dec 31 19:00:00 1969
@@ -1,14 +0,0 @@
-#!/bin/sh
-if [ $# -eq 0 -o x$1 = xstart ]; then
-  if [ -x %PREFIX%/sbin/tinyproxy ]; then
-   %PREFIX%/sbin/tinyproxy && echo ' tinyproxy'
-  fi
-fi
-if [ x$1 = xstop ]; then
-  if [ -f /var/run/tinyproxy.pid ]; then
-    kill `cat /var/run/tinyproxy.pid`
-  else
-    # oh well
-    killall tinyproxy
-  fi
-fi
diff -ruN www/tinyproxy.orig/files/tinyproxy.sh.in www/tinyproxy/files/tinyproxy.sh.in
--- www/tinyproxy.orig/files/tinyproxy.sh.in	Wed Dec 31 19:00:00 1969
+++ www/tinyproxy/files/tinyproxy.sh.in	Wed May  3 12:20:07 2006
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# PROVIDE: tinyproxy
+# REQUIRE: LOGIN
+
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf to enable tinyproxy:
+# tinyproxy_enable (bool): Set to "NO" by default.
+#                          Set it to "YES" to enable tinyproxy 
+# tinyproxy_config (path): Set to "%%PREFIX%%/etc/tinyproxy.conf" by default.
+#
+
+. %%RC_SUBR%%
+
+name="tinyproxy"
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+: ${tinyproxy_enable="NO"}
+: ${tinyproxy_config="%%PREFIX%%/etc/tinyproxy.conf"}
+
+command=%%PREFIX%%/sbin/tinyproxy
+command_args="-c $tinyproxy_config 2> /dev/null"
+
+run_rc_command "$1"
diff -ruN www/tinyproxy.orig/pkg-message www/tinyproxy/pkg-message
--- www/tinyproxy.orig/pkg-message	Thu May  6 04:03:51 2004
+++ www/tinyproxy/pkg-message	Wed Dec 31 19:00:00 1969
@@ -1,4 +0,0 @@
-You may then start the server by running:
-
-   /usr/local/etc/rc.d/tinyproxy.sh start
-
diff -ruN www/tinyproxy.orig/pkg-plist www/tinyproxy/pkg-plist
--- www/tinyproxy.orig/pkg-plist	Sun Oct 23 06:20:32 2005
+++ www/tinyproxy/pkg-plist	Wed May  3 10:07:40 2006
@@ -1,5 +1,6 @@
-etc/rc.d/tinyproxy.sh
-etc/tinyproxy/tinyproxy.conf-dist
+@unexec if cmp -s %D/etc/tinyproxy.conf-dist %D/etc/tinyproxy.conf; then rm -f %D/etc/tinyproxy.conf; fi
+etc/tinyproxy.conf-dist
+@exec if [ ! -f %D/etc/tinyproxy.conf ] ; then cp -p %D/%F %B/tinyproxy.conf; fi
 sbin/tinyproxy
 %%DATADIR%%/HTML_VARIABLES
 %%DATADIR%%/debug.html
@@ -9,4 +10,3 @@
 %%DATADIR%%/stats.html
 %%DATADIR%%/stats.html.dist
 @dirrm %%DATADIR%%
-@dirrm etc/tinyproxy
>Release-Note:
>Audit-Trail:
>Unformatted:



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