aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Lawrance <lawrance@FreeBSD.org>2006-02-11 14:43:10 +0000
committerSam Lawrance <lawrance@FreeBSD.org>2006-02-11 14:43:10 +0000
commit3d301eecf9bb9e117b686829f7185a8f30ad02cc (patch)
treefc34753e0452a04f01cecb59ec475f82345bf051
parente160263de012558519af56325c514645607830ef (diff)
downloadports-3d301eecf9bb9e117b686829f7185a8f30ad02cc.tar.gz
ports-3d301eecf9bb9e117b686829f7185a8f30ad02cc.zip
Out with the old rc.d script, in with the new.
PR: ports/91442 (requested by) Submitted by: Mike <mspam@hideaway.net> Approved by: mi (maintainer, timeout 4 weeks)
Notes
Notes: svn path=/head/; revision=155751
-rw-r--r--www/tclhttpd/Makefile10
-rw-r--r--www/tclhttpd/files/tclhttpd.sh24
-rw-r--r--www/tclhttpd/files/tclhttpd.sh.in42
-rw-r--r--www/tclhttpd/pkg-plist1
4 files changed, 46 insertions, 31 deletions
diff --git a/www/tclhttpd/Makefile b/www/tclhttpd/Makefile
index abcc24e71fb6..cd74b05d6e65 100644
--- a/www/tclhttpd/Makefile
+++ b/www/tclhttpd/Makefile
@@ -7,6 +7,7 @@
PORTNAME= tclhttpd
PORTVERSION= 3.5.1
+PORTREVISION= 1
CATEGORIES= www tcl83 tcl84
MASTER_SITES= ${MASTER_SITE_TCLTK}
MASTER_SITE_SUBDIR= httpd
@@ -18,14 +19,14 @@ COMMENT= An http-server implemented in TCL
RUN_DEPENDS= ${LOCALBASE}/lib/tcllib1.7/pkgIndex.tcl:${PORTSDIR}/devel/tcllib
LIB_DEPENDS= tcl${TCL_VER}:${PORTSDIR}/lang/tcl${TCL_VER}
+USE_RC_SUBR= tclhttpd.sh
TCL_DVER?= 8.4
TCL_VER= ${TCL_DVER:S/.//}
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-tcl="${LOCALBASE}/lib/tcl${TCL_DVER}" \
--with-tclinclude="${LOCALBASE}/include/tcl${TCL_DVER}"
-MAN1= tclhttpd.1
-RCD= ${LOCALBASE}/etc/rc.d/tclhttpd.sh
+MAN1= tclhttpd.1
.include <bsd.port.pre.mk>
SHLIB_NAME!= ${MAKE} -f "${FILESDIR}/Makefile.lib" -V SHLIB_NAME
@@ -33,6 +34,7 @@ PLIST_SUB+= TCL_VER=${TCL_VER} PORTVERSION=${PORTVERSION} \
SHLIB_NAME=${SHLIB_NAME}
MAKE_ENV+= TCLSH_PROG=tclsh${TCL_DVER}
SCRIPTS_ENV+= TCL_DVER=${TCL_DVER}
+SUB_LIST+= TCL_DVER=${TCL_DVER}
do-build:
cd ${WRKSRC} && ${MAKE_ENV} ${MAKE} -j 2 TCL_DVER="${TCL_DVER}" \
@@ -47,11 +49,7 @@ pre-install:
${MKDIR} ${PREFIX}/tclhttpd/custom
post-install:
- test -e ${RCD} || ${SED} \
- "s%COMMAND_LINE%${LOCALBASE}/bin/tclsh${TCL_DVER} ${PREFIX}/bin/httpd.tcl%" \
- < ${FILESDIR}/tclhttpd.sh > ${RCD}
${CHOWN} -R nobody ${DATADIR}${PORTVERSION}
- ${CHMOD} +x ${RCD}
${INSTALL_DATA} ${WRKSRC}/${SHLIB_NAME} \
${PREFIX}/lib/${PORTNAME}${PORTVERSION}/${SHLIB_NAME}
${INSTALL_SCRIPT} ${WRKSRC}/bin/httpd.tcl \
diff --git a/www/tclhttpd/files/tclhttpd.sh b/www/tclhttpd/files/tclhttpd.sh
deleted file mode 100644
index 6376cb49a646..000000000000
--- a/www/tclhttpd/files/tclhttpd.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-PID_FILE=/var/run/tclhttpd.pid
-case $1 in
- stop)
- if [ -e $PID_FILE ] ; then
- PID=`cat $PID_FILE`
- if kill $PID ; then
- exec rm -f $PID_FILE
- fi
- else
- echo "No $PID_FILE presenet, tclhttpd is, probably, not running" > /dev/stderr
- fi
- ;;
- ''|start)
- env LANG=C COMMAND_LINE &
- sleep 2
- if kill -0 $! ; then
- echo -n ' tclhttpd'
- echo $! > $PID_FILE
- else
- exec logger -s "tclhttpd failed to start"
- fi
- ;;
-esac
diff --git a/www/tclhttpd/files/tclhttpd.sh.in b/www/tclhttpd/files/tclhttpd.sh.in
new file mode 100644
index 000000000000..70f415371b2c
--- /dev/null
+++ b/www/tclhttpd/files/tclhttpd.sh.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: tclhttpd
+# REQUIRE: NETWORKING SERVERS
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable tclhttpd:
+#
+# tclhttpd_enable (bool): Set it to "YES" to enable tclhttpd
+# Default is "NO".
+#
+# tclhttpd_flags (str): Arguments to be passed to tclhttpd.
+# Default is "".
+#
+# tclhttpd_stdout_log(str): Set to the location for the tclhttpd
+# process log (standard out)
+#
+# tclhttpd_stderr_log (str): Set to the location for the tclhttpd
+# process log (standard error)
+
+. %%RC_SUBR%%
+
+name="tclhttpd"
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+: ${tclhttpd_enable="NO"}
+: ${tclhttpd_flags=""}
+: ${tclhttpd_stdout_log="/var/log/tclhttpd-stdout.log"}
+: ${tclhttpd_stderr_log="/var/log/tclhttpd-stderr.log"}
+
+procname="%%LOCALBASE%%/bin/tclsh%%TCL_DVER%%"
+pidfile=/var/run/tclhttpd.pid
+log_args=">> ${tclhttpd_stdout_log} \
+ 2>> ${tclhttpd_stderr_log} "
+command="/usr/sbin/daemon"
+flags="-p ${pidfile} %%LOCALBASE%%/bin/tclsh%%TCL_DVER%% %%PREFIX%%/bin/httpd.tcl ${tclhttpd_flags} ${log_args}"
+
+run_rc_command "$1"
diff --git a/www/tclhttpd/pkg-plist b/www/tclhttpd/pkg-plist
index c065bd260ad1..a02a51d2f544 100644
--- a/www/tclhttpd/pkg-plist
+++ b/www/tclhttpd/pkg-plist
@@ -2,7 +2,6 @@ bin/httpd.tcl
bin/httpdthread.tcl
etc/tclhttpd.rc
etc/tclhttpd.rc.default
-etc/rc.d/tclhttpd.sh
lib/tclhttpd%%PORTVERSION%%/%%SHLIB_NAME%%
lib/tclhttpd%%PORTVERSION%%/admin.tcl
lib/tclhttpd%%PORTVERSION%%/auth.tcl