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)
This commit is contained in:
Sam Lawrance 2006-02-11 14:43:10 +00:00
parent e160263de0
commit 3d301eecf9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=155751
4 changed files with 46 additions and 31 deletions

View file

@ -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 \

View file

@ -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

View file

@ -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"

View file

@ -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