aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2009-10-20 18:02:29 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2009-10-20 18:02:29 +0000
commit46b520e86682b12d0fdbd72f5e8d991befb82ad3 (patch)
tree606faa60b5aa863a2bf79e36773c07044c811d66
parent6e0113c0392915ed64e130ab4514b058b5e3b315 (diff)
downloadports-46b520e86682b12d0fdbd72f5e8d991befb82ad3.tar.gz
ports-46b520e86682b12d0fdbd72f5e8d991befb82ad3.zip
Notes
-rw-r--r--www/apache13-modssl/Makefile11
-rw-r--r--www/apache13-modssl/files/apache.in198
-rw-r--r--www/apache13-modssl/files/rcng.sh31
3 files changed, 200 insertions, 40 deletions
diff --git a/www/apache13-modssl/Makefile b/www/apache13-modssl/Makefile
index fc5909e0d24f..a3dadbe4a670 100644
--- a/www/apache13-modssl/Makefile
+++ b/www/apache13-modssl/Makefile
@@ -7,7 +7,7 @@
PORTNAME= apache+mod_ssl
PORTVERSION= ${VERSION_APACHE}+${VERSION_MODSSL}
-PORTREVISION?= 0
+PORTREVISION?= 1
CATEGORIES?= www security
MASTER_SITES= ${MASTER_SITE_APACHE_HTTPD} \
${MASTER_SITES_MODSSL:S/$/:mod_ssl/} \
@@ -57,7 +57,7 @@ MODSSL_FILE= mod_ssl-${VERSION_MODSSL}-${VERSION_APACHE}${EXTRACT_SUFX}
MODSNMP_FILE= mod_snmp_${VERSION_MODSNMP}${EXTRACT_SUFX}
RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
-USE_RC_SUBR= yes
+USE_RC_SUBR= apache
.include <bsd.port.pre.mk>
@@ -89,10 +89,6 @@ check-depends::
@${FALSE}
.endif
-APACHE_SH?= etc/rc.d/apache
-
-PLIST_FILES+= ${APACHE_SH}
-
.if defined(WITH_APACHE_SUEXEC) && !defined(WITHOUT_APACHE_SUEXEC)
APACHE_SUEXEC_DOCROOT?=${DOCUMENT_ROOT}
@@ -381,8 +377,6 @@ pre-fetch:
@${ECHO_MSG} ""
post-extract:
- @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
- ${FILESDIR}/rcng.sh > ${WRKSRC}/rcng.sh
@${REINPLACE_CMD} -e 's|echo aout|echo elf|' \
${WRKSRC}/src/Configure
.if defined(WITH_APACHE_MODSNMP) || defined(APACHE_WITH_MODSNMP)
@@ -429,7 +423,6 @@ pre-install:
@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
- ${INSTALL_SCRIPT} ${WRKSRC}/rcng.sh ${PREFIX}/${APACHE_SH}
.if defined(WITH_APACHE_MODSNMP) || defined(APACHE_WITH_MODSNMP)
@${MKDIR} ${DATADIR}/buckets
@${CHOWN} www:www ${DATADIR}/buckets
diff --git a/www/apache13-modssl/files/apache.in b/www/apache13-modssl/files/apache.in
new file mode 100644
index 000000000000..ca50c726e736
--- /dev/null
+++ b/www/apache13-modssl/files/apache.in
@@ -0,0 +1,198 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: apache
+# REQUIRE: LOGIN cleanvar
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable apache:
+# apache_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable apache
+# apache_profiles (str): Set to "" by default.
+# Define your profiles here.
+# apachelimits_enable (bool):Set to "NO" by default.
+# Set it to yes to run `limits $limits_args`
+# just before apache starts.
+# apache_flags (str): Set to "-DSSL" by default.
+# Extra flags passed to start command.
+# apachelimits_args (str): Default to "-e -C daemon"
+# Arguments of pre-start limits run.
+# apache_http_accept_enable (bool): Set to "NO" by default.
+# Set to yes to check for accf_http kernel
+# module on start up and load if not loaded.
+# apache_fib (str): Set an altered default network view for apache
+
+. %%RC_SUBR%%
+
+name="apache"
+rcvar=`set_rcvar`
+
+start_precmd="apache_prestart"
+restart_precmd="apache_checkconfig"
+reload_precmd="apache_checkconfig"
+reload_cmd="apache_graceful"
+graceful_cmd="apache_graceful"
+gracefulstop_cmd="apache_gracefulstop"
+configtest_cmd="apache_checkconfig"
+command="%%PREFIX%%/sbin/httpd"
+_pidprefix="/var/run/httpd"
+pidfile="${_pidprefix}.pid"
+required_files=%%PREFIX%%/etc/apache/httpd.conf
+
+[ -z "$apache_enable" ] && apache_enable="NO"
+[ -z "$apache_profiles" ] && apache_profiles=""
+[ -z "$apache_flags" ] && apache_flags="-DSSL"
+[ -z "$apachelimits_enable" ] && apachelimits_enable="NO"
+[ -z "$apachelimits_args" ] && apachelimits_args="-e -C daemon"
+[ -z "$apache_http_accept_enable" ] && apache_http_accept_enable="NO"
+[ -z "$apache_fib" ] && apache_fib="NO"
+
+apache_accf() {
+ retcode=0
+ if checkyesno apache_http_accept_enable
+ then
+ /sbin/kldstat -v | grep accf_http >/dev/null 2>&1
+ retcode=${?}
+ if [ ${retcode} -ne 0 ]
+ then
+ /sbin/kldload accf_http 2> /dev/null
+ retcode=${?}
+ fi
+ else
+ apache_flags="${apache_flags} -DNOHTTPACCEPT"
+ fi
+ [ ${retcode} -ne 0 ] && echo "Unable to load accf_http module"
+ return ${retcode}
+}
+
+load_rc_config $name
+
+if [ -n "$2" ]; then
+ profile="$2"
+ if [ "x${apache_profiles}" != "x" ]; then
+ pidfile="${_pidprefix}.${profile}.pid"
+ eval apache_configfile="\${apache_${profile}_configfile:-}"
+ if [ "x${apache_configfile}" = "x" ]; then
+ echo "You must define a configuration file (apache_${profile}_configfile)"
+ exit 1
+ fi
+ required_files="${apache_configfile}"
+ eval apache_enable="\${apache_${profile}_enable:-${apache_enable}}"
+ eval apache_flags="\${apache_${profile}_flags:-${apache_flags}}"
+ eval apache_http_accept_enable="\${apache_${profile}_http_accept_enable:-${apache_http_accept_enable}}"
+ eval apachelimits_enable="\${apachelimits_${profile}_enable:-${apachelimits_enable}}"
+ eval apachelimits_args="\${apachelimits_${profile}_args:-${apachelimits_args}}"
+ eval apache_fib="\${apache_${profile}_fib:-${apache_fib}}"
+ apache_flags="-f ${apache_configfile} -c \"PidFile ${pidfile}\" ${apache_flags}"
+ else
+ echo "$0: extra argument ignored"
+ fi
+else
+ if [ "x${apache_profiles}" != "x" -a "x$1" != "x" ]; then
+ for profile in ${apache_profiles}; do
+ eval _enable="\${apache_${profile}_enable}"
+ case "x${_enable:-${apache_enable}}" in
+ x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
+ continue
+ ;;
+ x[Yy][Ee][Ss])
+ ;;
+ *)
+ if test -z "$_enable"; then
+ _var=apache_enable
+ else
+ _var=apache_"${profile}"_enable
+ fi
+ echo "Bad value" \
+ "'${_enable:-${apache_enable}}'" \
+ "for ${_var}. " \
+ "Profile ${profile} skipped."
+ continue
+ ;;
+ esac
+ echo "===> apache profile: ${profile}"
+ %%PREFIX%%/etc/rc.d/apache%%RC_SUBR_SUFFIX%% $1 ${profile}
+ retcode="$?"
+ if [ "0${retcode}" -ne 0 ]; then
+ failed="${profile} (${retcode}) ${failed:-}"
+ else
+ success="${profile} ${success:-}"
+ fi
+ done
+ exit 0
+ fi
+fi
+
+if [ "${1}" != "stop" ] ; then \
+ apache_accf || apache_flags="${apache_flags} -DNOHTTPACCEPT"
+fi
+
+apache_requirepidfile()
+{
+ if [ ! "0`check_pidfile ${pidfile} ${command}`" -gt 1 ]; then
+ echo "${name} not running? (check $pidfile)."
+ exit 1
+ fi
+}
+
+apache_checkconfig()
+{
+ if test -f %%PREFIX%%/sbin/envvars
+ then
+ . %%PREFIX%%/sbin/envvars
+ fi
+
+ echo "Performing sanity check on apache configuration:"
+ eval ${command} ${apache_flags} -t
+}
+
+apache_graceful() {
+ apache_requirepidfile
+
+ echo "Performing a graceful restart"
+ eval ${command} ${apache_flags} -k graceful
+}
+
+apache_gracefulstop() {
+ apache_requirepidfile
+
+ echo "Performing a graceful stop"
+ eval ${command} ${apache_flags} -k graceful-stop
+}
+
+apache_precmd()
+{
+ apache_checkconfig
+
+ if checkyesno apachelimits_enable
+ then
+ eval `/usr/bin/limits ${apachelimits_args}` 2>/dev/null
+ else
+ return 0
+ fi
+
+}
+
+apache_checkfib () {
+ sysctl net.fibs >/dev/null 2>&1
+ ret=$?
+ [ $ret -gt 0 ] && return 0
+ if [ "x$apache_fib" != "xNO" ]
+ then
+ command="setfib -F ${apache_fib} ${command}"
+ else
+ return 0
+ fi
+}
+
+apache_prestart() {
+ apache_checkfib
+ apache_precmd
+}
+
+extra_commands="reload graceful gracefulstop configtest"
+run_rc_command "$1"
+# eof
diff --git a/www/apache13-modssl/files/rcng.sh b/www/apache13-modssl/files/rcng.sh
deleted file mode 100644
index 1a7c12ca997f..000000000000
--- a/www/apache13-modssl/files/rcng.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-# $FreeBSD$
-
-# PROVIDE: apache
-# REQUIRE: DAEMON
-# BEFORE: LOGIN
-# KEYWORD: shutdown
-
-# Define these apache_* variables in one of these files:
-# /etc/rc.conf
-# /etc/rc.conf.local
-# /etc/rc.conf.d/apache
-#
-# DO NOT CHANGE THESE DEFAULT VALUES HERE
-#
-apache_enable="${apache_enable-NO}"
-apache_flags=${apache_flags-"-DSSL"}
-apache_pidfile="/var/run/httpd.pid"
-
-. %%RC_SUBR%%
-
-name="apache"
-rcvar=`set_rcvar`
-command="%%PREFIX%%/sbin/httpd"
-
-load_rc_config $name
-
-pidfile="${apache_pidfile}"
-start_precmd="`/usr/bin/limits -e -U www`"
-
-run_rc_command "$1"