ports/72298: thttpd update (move to rc_subr)
Jeremy Chadwick
freebsd at jdc.parodius.com
Mon Oct 4 09:20:22 UTC 2004
>Number: 72298
>Category: ports
>Synopsis: thttpd update (move to rc_subr)
>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: Mon Oct 04 09:20:21 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Jeremy Chadwick
>Release: FreeBSD 4.10-STABLE i386
>Organization:
Parodius Networking
>Environment:
System: FreeBSD pentarou.parodius.com 4.10-STABLE FreeBSD 4.10-STABLE #0: Sat Sep 18 21:49:46 PDT 2004 root at pentarou.parodius.com:/usr/obj/usr/src/sys/PENTAROU i386
>Description:
A few changes to the thttpd port:
* Switch to rc_subr/rc.subr
* Remove USE_REINPLACE -- no longer needed
* Removal of thttpd_wrapper -- rc.subr takes care of this cleanly, and allow
people to use thttpd_flags too
* Removal of %%PREFIX%%/www/logs -- use /var/log instead. This is entirely
configurable in the thttpd.conf
* Install bin/syslogtocern via ${INSTALL_SCRIPT} since that's what it is
* Removal of tons of realtime ${ECHO}s to create conf files and other things
* Use of the ${WWWOWN} user; no longer runs as nobody
* Pass pkg-message through ${SED}, so we can use %%PREFIX%% there
Tested on 5.3-BETA6, but also tested a build (but not install) on 4.10-STABLE.
Please have the port maintainer review this before committing. Also,
committer, please ensure that a $FreeBSD$ CVS tag gets stuck on
thttpd/files/thttpd.sh !
>How-To-Repeat:
n/a
>Fix:
Apply below patch:
diff -ruN thttpd.orig/Makefile thttpd/Makefile
--- thttpd.orig/Makefile Fri May 28 05:48:38 2004
+++ thttpd/Makefile Mon Oct 4 02:07:48 2004
@@ -7,6 +7,7 @@
PORTNAME= thttpd
PORTVERSION= 2.25b
+PORTREVISION= 1
CATEGORIES= www ipv6
MASTER_SITES= http://www.acme.com/software/thttpd/ \
http://atreides.freenix.no/~anders/
@@ -20,11 +21,17 @@
IGNOREFILES= notes.html
GNU_CONFIGURE= yes
-USE_REINPLACE= yes
+
+USE_RC_SUBR= yes
+SED_SCRIPT= -e 's,%%PREFIX%%,${PREFIX},g' \
+ -e 's,%%RC_SUBR%%,${RC_SUBR},g' \
+ -e 's,%%WWWOWN%%,${WWWOWN},g'
MAN1= makeweb.1 htpasswd.1
MAN8= thttpd.8 redirect.8 ssi.8 syslogtocern.8
+PKGMESSAGE= ${WRKDIR}/pkg-message
+
.include <bsd.port.pre.mk>
do-install:
@@ -32,7 +39,6 @@
@${INSTALL_MAN} ${WRKSRC}/thttpd.8 ${PREFIX}/man/man8
@${INSTALL} -d -o root -g wheel -m 0755 ${PREFIX}/www
@${INSTALL} -d -o root -g wheel -m 0755 ${PREFIX}/www/data
- @${INSTALL} -d -o root -g wheel -m 0755 ${PREFIX}/www/logs
@${INSTALL} -d -o root -g wheel -m 0755 ${PREFIX}/www/cgi-bin
@${INSTALL_PROGRAM} ${WRKSRC}/cgi-src/redirect ${PREFIX}/www/cgi-bin/
@${INSTALL_PROGRAM} ${WRKSRC}/cgi-src/ssi ${PREFIX}/www/cgi-bin/
@@ -40,53 +46,29 @@
@${INSTALL_MAN} ${WRKSRC}/cgi-src/redirect.8 ${PREFIX}/man/man8
@${INSTALL_MAN} ${WRKSRC}/cgi-src/ssi.8 ${PREFIX}/man/man8
@${INSTALL_PROGRAM} ${WRKSRC}/extras/makeweb ${PREFIX}/bin/
- @${INSTALL} -c -m 755 -o root -g wheel ${WRKSRC}/extras/syslogtocern ${PREFIX}/bin/
@${INSTALL_PROGRAM} ${WRKSRC}/extras/htpasswd ${PREFIX}/bin/
+ @${INSTALL_SCRIPT} ${WRKSRC}/extras/syslogtocern ${PREFIX}/bin/
@${INSTALL_MAN} ${WRKSRC}/extras/makeweb.1 ${PREFIX}/man/man1
@${INSTALL_MAN} ${WRKSRC}/extras/htpasswd.1 ${PREFIX}/man/man1
@${INSTALL_MAN} ${WRKSRC}/extras/syslogtocern.8 ${PREFIX}/man/man8
- @if [ ! -f ${PREFIX}/sbin/thttpd_wrapper ]; then \
- ${ECHO} "Installing ${PREFIX}/sbin/thttpd_wrapper file."; \
- ${ECHO_CMD} "#!/bin/sh" > ${PREFIX}/sbin/thttpd_wrapper; \
- ${ECHO_CMD} "${ECHO_CMD} \$$\$$ > /var/run/thttpd_wrapper.pid" >> ${PREFIX}/sbin/thttpd_wrapper; \
- ${ECHO_CMD} "while true ; do" >> ${PREFIX}/sbin/thttpd_wrapper; \
- ${ECHO_CMD} " ${PREFIX}/sbin/thttpd -D -C ${PREFIX}/etc/thttpd.conf" >> ${PREFIX}/sbin/thttpd_wrapper; \
- ${ECHO_CMD} " sleep 10" >> ${PREFIX}/sbin/thttpd_wrapper; \
- ${ECHO_CMD} "done" >> ${PREFIX}/sbin/thttpd_wrapper; \
- ${CHMOD} 751 ${PREFIX}/sbin/thttpd_wrapper; \
- fi
- @${ECHO} "Installing ${PREFIX}/etc/thttpd.conf.sample configuration file."
- @${ECHO_CMD} "dir=${PREFIX}/www/data" > ${PREFIX}/etc/thttpd.conf.sample
- @${ECHO_CMD} "chroot" >> ${PREFIX}/etc/thttpd.conf.sample
- @${ECHO_CMD} "cgipat=*.cgi" >> ${PREFIX}/etc/thttpd.conf.sample
- @${ECHO_CMD} "logfile=${PREFIX}/www/logs/thttpd.log" >> ${PREFIX}/etc/thttpd.conf.sample
- @${ECHO_CMD} "pidfile=/var/run/thttpd.pid" >> ${PREFIX}/etc/thttpd.conf.sample
- @if [ ! -f ${PREFIX}/etc/rc.d/thttpd.sh ]; then \
- ${ECHO} "Installing ${PREFIX}/etc/rc.d/thttpd.sh startup file."; \
- ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/thttpd.sh ${PREFIX}/etc/rc.d/thttpd.sh; \
- ${REINPLACE_CMD} -i '' -e 's|%%PREFIX%%|${PREFIX}|g' ${PREFIX}/etc/rc.d/thttpd.sh; \
- fi
+ @${INSTALL_DATA} ${WRKDIR}/thttpd.conf.sample ${PREFIX}/etc/thttpd.conf.sample
+ @${INSTALL_SCRIPT} ${WRKDIR}/thttpd.sh ${PREFIX}/etc/rc.d/thttpd.sh
.if !defined(NOPORTDOCS)
@${MKDIR} ${PREFIX}/share/doc/thttpd
@${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/notes.html ${PREFIX}/share/doc/thttpd
.endif
+post-build:
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/thttpd.sh > ${WRKDIR}/thttpd.sh
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/thttpd.conf.sample > ${WRKDIR}/thttpd.conf.sample
+
post-install:
+ @${SED} ${SED_SCRIPT} ${MASTERDIR}/pkg-message > ${PKGMESSAGE}
@${CAT} ${PKGMESSAGE}
-post-configure: config-message
+post-configure:
.if ${OSVERSION} > 502101
@cd ${WRKSRC} && patch < ${PATCHDIR}/extra-patch-config.h
.endif
-
-post-build: config-message
-
-config-message:
- @${ECHO} "====================================================================="
- @${ECHO} ""
- @${ECHO} "Be sure to take a look at the options in config.h before (re)building"
- @${ECHO} "if you want to tweak the server."
- @${ECHO} ""
- @${ECHO} "====================================================================="
.include <bsd.port.post.mk>
diff -ruN thttpd.orig/files/thttpd.conf.sample thttpd/files/thttpd.conf.sample
--- thttpd.orig/files/thttpd.conf.sample Wed Dec 31 16:00:00 1969
+++ thttpd/files/thttpd.conf.sample Mon Oct 4 02:02:39 2004
@@ -0,0 +1,6 @@
+user=%%WWWOWN%%
+dir=%%PREFIX%%/www/data
+chroot
+cgipat=*.cgi
+logfile=/var/log/thttpd.log
+pidfile=/var/run/thttpd.pid
diff -ruN thttpd.orig/files/thttpd.sh thttpd/files/thttpd.sh
--- thttpd.orig/files/thttpd.sh Tue Aug 13 14:39:47 2002
+++ thttpd/files/thttpd.sh Mon Oct 4 02:05:04 2004
@@ -1,18 +1,29 @@
#!/bin/sh
+#
+# <<insert FreeBSD CVS ID tag here>>
+#
-case "$1" in
-start)
- if [ -x %%PREFIX%%/sbin/thttpd_wrapper ]; then
- %%PREFIX%%/sbin/thttpd_wrapper &
- echo -n ' thttpd'
- fi
- ;;
-stop)
- kill `cat /var/run/thttpd_wrapper.pid` && killall thttpd && echo -n ' thttpd'
- ;;
-*)
- echo "Usage: `basename $0` {start|stop}" >&2
- ;;
-esac
+# PROVIDE: thttpd
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD shutdown
-exit 0
+#
+# Add the following line to /etc/rc.conf to enable thttpd:
+#
+# thttpd_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name=thttpd
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/thttpd
+required_files=%%PREFIX%%/etc/thttpd.conf
+
+thttpd_enable=${thttpd_enable:-"NO"}
+thttpd_flags=${thttpd_flags:-"-C %%PREFIX%%/etc/thttpd.conf"}
+
+load_rc_config $name
+run_rc_command "$1"
diff -ruN thttpd.orig/pkg-message thttpd/pkg-message
--- thttpd.orig/pkg-message Wed Mar 22 18:25:32 2000
+++ thttpd/pkg-message Mon Oct 4 02:00:28 2004
@@ -1,11 +1,9 @@
-===========================================================================
+-----------------------------------------------------------------
+If you want users to be able to create their own Web
+subdirectories off of the main web directory, you need to:
- If you want users to be able to create their own web
- subdirectories off of the main web directory, you need to:
-
- a) add a group for www admins
- b) chgrp yourgroup ${PREFIX}/bin/makeweb ${PREFIX}/www
- c) chmod 2755 ${PREFIX}/bin/makeweb
- d) tell them about makeweb(1)
-
-===========================================================================
+ 1. Add a group for www admins
+ 2. chgrp yourgroup %%PREFIX%%/bin/makeweb %%PREFIX%%/www
+ 3. chmod 2755 %%PREFIX%%/bin/makeweb
+ 4. Tell them about makeweb(1)
+-----------------------------------------------------------------
diff -ruN thttpd.orig/pkg-plist thttpd/pkg-plist
--- thttpd.orig/pkg-plist Tue Jun 8 23:16:04 2004
+++ thttpd/pkg-plist Mon Oct 4 02:07:08 2004
@@ -4,7 +4,6 @@
etc/rc.d/thttpd.sh
etc/thttpd.conf.sample
sbin/thttpd
-sbin/thttpd_wrapper
%%PORTDOCS%%%%DOCSDIR%%/notes.html
www/cgi-bin/phf
www/cgi-bin/redirect
@@ -12,4 +11,3 @@
%%PORTDOCS%%@dirrm %%DOCSDIR%%
@unexec rmdir %D/www/cgi-bin 2> /dev/null || true
@unexec rmdir %D/www/data 2> /dev/null || true
- at unexec rmdir %D/www/logs 2> /dev/null || true
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list