diff options
Diffstat (limited to 'www')
-rw-r--r-- | www/apache13-fp/Makefile | 6 | ||||
-rw-r--r-- | www/apache13-fp/files/apache.sh.tmpl | 127 |
2 files changed, 102 insertions, 31 deletions
diff --git a/www/apache13-fp/Makefile b/www/apache13-fp/Makefile index a3703efd5d71..ce195cf1b633 100644 --- a/www/apache13-fp/Makefile +++ b/www/apache13-fp/Makefile @@ -141,9 +141,9 @@ pre-install: post-install: @if [ ! -f ${PREFIX}/etc/rc.d/apache.sh ]; then \ ${ECHO} "Installing ${PREFIX}/etc/rc.d/apache.sh file."; \ - ${SED} -e 's;PREFIX;${PREFIX};' \ - -e 's;PERL5;${PERL};' \ - -e 's;FP_VER;${FP_VER};' \ + ${SED} -e 's;%%PREFIX%%;${PREFIX};' \ + -e 's;%%PERL5%%;${PERL};' \ + -e 's;%%FP_VER%%;${FP_VER};' \ < ${FILESDIR}/apache.sh.tmpl > ${PREFIX}/etc/rc.d/apache.sh; \ ${CHMOD} 751 ${PREFIX}/etc/rc.d/apache.sh; \ fi diff --git a/www/apache13-fp/files/apache.sh.tmpl b/www/apache13-fp/files/apache.sh.tmpl index f6019253ee6f..982cbdcc8174 100644 --- a/www/apache13-fp/files/apache.sh.tmpl +++ b/www/apache13-fp/files/apache.sh.tmpl @@ -1,17 +1,50 @@ #!/bin/sh # +# $FreeBSD$ +# PROVIDE: apache +# REQUIRE: DAEMON +# KEYWORD: FreeBSD shutdown # -# Create New FrontPage suidkey +# NOTE for FreeBSD 5.0+: +# If you want this script to start with the base rc scripts +# move apache.sh to /etc/rc.d/apache + +# Define the following apache_* variables in one of the following: +# /etc/rc.conf +# /etc/rc.conf.d/apache +# ${prefix}/etc/rc.conf.d/apache +# +# apache_enable - Set to YES to enable apache +# +# apache_program - Path to apache program +# Default: ${prefix}/sbin/httpd # +# apache_start - Subcommand sent to apachectl to control how +# httpd is started. +# Default: start_FP + +prefix=%%PREFIX%% + +apache_doit () +{ + case $1 in + start) action=${apache_start} ;; + reload) action=graceful ;; + *) action=$1 ;; + esac + ${ctl_command} ${action} +} + +# Create New FrontPage suidkey new_key() { CUR_UMASK=`umask` - skdir=PREFIX/frontpage/versionFP_VER/apache-fp - PERL=PERL5 + skdir=${prefix}/frontpage/version%%FP_VER%%/apache-fp + PERL=%%PERL5%% - if [ -x PREFIX/libexec/apache/mod_frontpage.so ] + if [ -x ${prefix}/libexec/apache/mod_frontpage.so ] then #NOTE: We need Perl 5, to generate a new key @@ -25,35 +58,73 @@ new_key() { } -# -# Main -# +if [ -f /etc/rc.subr ]; then -if [ -x PREFIX/libexec/apache/mod_frontpage.so ] -then - MODULES="_FP" -fi + . /etc/rc.subr + + name="apache" + rcvar=`set_rcvar` + command="${prefix}/sbin/httpd" + ctl_command="${prefix}/sbin/apachectl" + # pidfile=/var/run/httpd.pid + required_files="${prefix}/etc/apache/httpd.conf" + extra_commands="reload" + start_precmd="new_key" + start_cmd="apache_doit start" + stop_cmd="apache_doit stop" + restart_cmd="apache_doit restart" + reload_cmd="apache_doit reload" -case "$1" in + # The below may be removed when load_local_rc_config is added to rc.subr -start) - if [ -x PREFIX/sbin/apachectl ] - then - new_key - PREFIX/sbin/apachectl start${MODULES} && echo -n ' httpd' + if [ -f ${prefix}/etc/rc.conf.d/"$name" ]; then + debug "Sourcing ${prefix}/etc/rc.conf.d/${name}" + . ${prefix}/etc/rc.conf.d/"$name" fi - ;; -stop) - if [ -r /var/run/httpd.pid ] - then - PREFIX/sbin/apachectl stop && echo -n ' httpd' + load_rc_config $name + + if [ -z "${apache_enable}" ] ; then + apache_enable=yes + fi + + # The above may be removed when load_local_rc_config is added to rc.subr + # + # load_local_rc_config $name + + if [ -z "${apache_start}" ]; then + apache_start="start_FP" + fi + + run_rc_command "$1" +else + if [ -f ${prefix}/etc/rc.conf.d/apache ]; then + . ${prefix}/etc/rc.conf.d/apache + fi + + if [ -z '${apache_start}" ]; then + apache_start="start_FP" fi - ;; -*) - echo "usage: $0 {start|stop}" 1>&2 - exit 64 - ;; + case "$1" in + + start) + if [ -x ${prefix}/sbin/apachectl ]; then + new_key + ${prefix}/sbin/apachectl ${apache_start} && echo -n ' httpd' + fi + ;; -esac + stop) + if [ -r /var/run/httpd.pid ]; then + ${prefix}/sbin/apachectl stop && echo -n ' httpd' + fi + ;; + + *) + echo "usage: $0 {start|stop}" 1>&2 + exit 64 + ;; + + esac +fi |