summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2018-03-15 11:07:38 +0100
committerLars Wendler <polynomial-c@gentoo.org>2018-03-15 11:09:38 +0100
commit9e3d349cc1ee14e91d377b6a38c786ac4b153fe5 (patch)
tree1a6a77c6c7e6d75af4f6ae35c8ed7e5be90349c8 /2.4/scripts/apache2ctl
parentAdded 41_mod_http2.conf to apache-2.4 modules.d directory. (diff)
downloadapache-9e3d349cc1ee14e91d377b6a38c786ac4b153fe5.tar.gz
apache-9e3d349cc1ee14e91d377b6a38c786ac4b153fe5.tar.bz2
apache-9e3d349cc1ee14e91d377b6a38c786ac4b153fe5.zip
2.4/scripts/apache2ctl: Pass commands to the apache daemon.
Gentoo-Bug: https://bugs.gentoo.org/634414 Thanks-to: Joona Hoikkala <joona@kuori.org> Thanks-to: Andrey Falko <Ma3oxuct@gmail.com>
Diffstat (limited to '2.4/scripts/apache2ctl')
-rw-r--r--[-rwxr-xr-x]2.4/scripts/apache2ctl25
1 files changed, 24 insertions, 1 deletions
diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl
index eff10b5..2c7c699 100755..100644
--- a/2.4/scripts/apache2ctl
+++ b/2.4/scripts/apache2ctl
@@ -1,2 +1,25 @@
#!/bin/sh
-exec /etc/init.d/apache2 "$@"
+
+APACHE2="/usr/sbin/apache2"
+APACHE_OPTS=""
+APACHE_RC_CONF="/etc/conf.d/apache2"
+# List of init script verbs that should be passed forward
+RC_VERBS="start stop restart checkconfd configtest modules virtualhosts configdump fullstatus graceful gracefulstop reload"
+
+load_rc_config() {
+ [ -f "${APACHE_RC_CONF}" ] || return 1
+ eval "export $(grep '^[[:space:]]*APACHE2_OPTS' ${APACHE_RC_CONF})"
+ eval $(grep '^[[:space:]]*SERVERROOT' ${APACHE_RC_CONF})
+ eval $(grep '^[[:space:]]*CONFIGFILE' ${APACHE_RC_CONF})
+ export SERVERROOT="${SERVERROOT:-/usr/@LIBDIR@/apache2}"
+ export CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}"
+}
+
+# If first parameter is a verb defined in $RC_VERBS, pass the command to init script.
+# In other cases, compile command line and run the command on apache binary.
+if [ "${RC_VERBS}" =~ "${1}" ] ; then
+ exec /etc/init.d/apache2 "${@}"
+else
+ load_rc_config || exit 1
+ ${APACHE2} ${APACHE2_OPTS} -d ${SERVERROOT} -f ${CONFIGFILE} "${@}"
+fi