diff --git a/www/thttpd/Makefile b/www/thttpd/Makefile index 8b0e043ec401..f0801ba53539 100644 --- a/www/thttpd/Makefile +++ b/www/thttpd/Makefile @@ -20,6 +20,7 @@ MAINTAINER= anders@FreeBSD.org IGNOREFILES= notes.html GNU_CONFIGURE= yes +USE_REINPLACE= yes MAN1= makeweb.1 htpasswd.1 MAN8= thttpd.8 redirect.8 ssi.8 syslogtocern.8 @@ -61,6 +62,7 @@ do-install: @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} -e 's|%%PREFIX%%|${PREFIX}|g' ${PREFIX}/etc/rc.d/thttpd.sh; \ fi .if !defined(NOPORTDOCS) @${MKDIR} ${PREFIX}/share/doc/thttpd diff --git a/www/thttpd/files/thttpd.sh b/www/thttpd/files/thttpd.sh index 6129c1145d58..e559a172d3f6 100644 --- a/www/thttpd/files/thttpd.sh +++ b/www/thttpd/files/thttpd.sh @@ -1,13 +1,11 @@ #!/bin/sh -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - case "$1" in start) - [ -x ${PREFIX}/sbin/thttpd_wrapper ] && ${PREFIX}/sbin/thttpd_wrapper & && echo -n ' thttpd' + 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'