Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 570900 Details for
Bug 673530
www-servers/apache: apache2ctl broken on systemd installations
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for apache2ctl that supports systemd
0001-apache2ctl-Add-suport-for-systemd.patch (text/plain), 6.17 KB, created by
Michael Strache
on 2019-03-26 23:02:50 UTC
(
hide
)
Description:
Proposed patch for apache2ctl that supports systemd
Filename:
MIME Type:
Creator:
Michael Strache
Created:
2019-03-26 23:02:50 UTC
Size:
6.17 KB
patch
obsolete
>From 3103367891f6d60636cb9f725fe36c1c251c939b Mon Sep 17 00:00:00 2001 >From: Jarod <jarodiv@web.de> >Date: Tue, 26 Mar 2019 23:27:31 +0100 >Subject: [PATCH] apache2ctl: Add suport for systemd > >--- > 2.4/scripts/apache2ctl | 182 +++++++++++++++++++++++++++++++++++++---- > 1 file changed, 165 insertions(+), 17 deletions(-) > >diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl >index 8031b8b..392ac4c 100644 >--- a/2.4/scripts/apache2ctl >+++ b/2.4/scripts/apache2ctl >@@ -6,23 +6,171 @@ 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 >- if ! grep -q '^[[:space:]]*APACHE2_OPTS' ${APACHE_RC_CONF} ; then >- echo "Cannot find APACHE2_OPTS in ${APACHE_RC_CONF}" >- exit 1 >- fi >- . ${APACHE_RC_CONF} >- export APACHE2_OPTS >- export SERVERROOT="${SERVERROOT:-/usr/@LIBDIR@/apache2}" >- export CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}" >+ >+function is_systemd() { >+ [ $(ps --no-headers -o comm 1) == "systemd" ] && return 0 >+ return 1 >+} >+ >+function load_rc_config() { >+ [ -f "${APACHE_RC_CONF}" ] || return 1 >+ if ! grep -q '^[[:space:]]*APACHE2_OPTS' ${APACHE_RC_CONF} ; then >+ echo "Cannot find APACHE2_OPTS in ${APACHE_RC_CONF}" >+ exit 1 >+ fi >+ . ${APACHE_RC_CONF} >+ export APACHE2_OPTS >+ export SERVERROOT="${SERVERROOT:-/usr/lib64/apache2}" >+ export CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}" >+} >+ >+# Basically the code from '/etc/init.d/apache2::reload()', updated to run without open-rc >+function reload() { >+ RELOAD_TYPE="${RELOAD_TYPE:-graceful}" >+ >+ if [ "${RELOAD_TYPE}" = "restart" ]; then >+ ${APACHE2} ${APACHE2_OPTS} -k restart >+ elif [ "${RELOAD_TYPE}" = "graceful" ]; then >+ ${APACHE2} ${APACHE2_OPTS} -k graceful >+ else >+ echo "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit /etc/conf.d/apache2" >+ fi >+} >+ >+# Basically the code from '/etc/init.d/apache2::fullstatus()', updated to run without open-rc >+function fullstatus() { >+ LYNX="${LYNX:-lynx -dump}" >+ STATUSURL="${STATUSURL:-http://localhost/server-status}" >+ >+ if ! command -v $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then >+ echo 'lynx not found! you need to emerge www-client/lynx' >+ else >+ ${LYNX} ${STATUSURL} >+ fi >+ return $? > } > >-# 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 echo "${RC_VERBS}" | grep -q -- "${1}" ; then >- exec /etc/init.d/apache2 "${@}" >-else >- load_rc_config || exit 1 >- ${APACHE2} ${APACHE2_OPTS} -d ${SERVERROOT} -f ${CONFIGFILE} "${@}" >+# Basically the code from '/etc/init.d/apache2::checkconfd()', updated to run without open-rc >+function checkconfd() { >+ if [ ! -d ${SERVERROOT} ]; then >+ echo "SERVERROOT does not exist: ${SERVERROOT}" >+ return 1 >+ fi >+} >+ >+# Basically the code from '/etc/init.d/apache2::checkconfig()', updated to run without open-rc >+function configtest() { >+ checkconfd || return 1 >+ >+ OUTPUT=$( ${APACHE2} ${APACHE2_OPTS} -t 2>&1 ) >+ ret=$? >+ if [ $ret -ne 0 ]; then >+ echo "apache2 has detected an error in your setup:" >+ printf "%s\n" "${OUTPUT}" >+ fi >+ >+ return $ret >+} >+ >+# Basically the code from '/etc/init.d/apache2::configdump()', updated to run without open-rc >+function configdump() { >+ INFOURL="${INFOURL:-http://localhost/server-info}" >+ >+ if ! command -v $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then >+ echo "lynx not found! you need to emerge www-client/lynx" >+ else >+ echo "${APACHE2} started with '${APACHE2_OPTS}'" >+ for i in config server list; do >+ ${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q' >+ done >+ fi >+} >+ >+ >+# If systemd IS NOT detected, run the legacy apache2ctl code >+if ! is_systemd; then >+ # 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 echo "${RC_VERBS}" | grep -q -- "${1}" ; then >+ exec /etc/init.d/apache2 "${@}" >+ else >+ load_rc_config || exit 1 >+ ${APACHE2} ${APACHE2_OPTS} -d ${SERVERROOT} -f ${CONFIGFILE} "${@}" >+ fi >+ exit 0 > fi >+ >+# If systemd IS detected, load the config and parse the argument >+load_rc_config || exit 1 >+ >+# Append the server root and configuration file parameters to the >+# user's APACHE2_OPTS. >+APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}" >+APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}" >+ >+case $1 in >+# Original apachectl options >+# See: https://httpd.apache.org/docs/2.4/programs/apachectl.html >+start|stop|restart|status) >+ /bin/systemctl $1 apache2.service >+ ERROR=$? >+ ;; >+ >+reload) >+ reload >+ ERROR=$? >+ ;; >+ >+fullstatus) >+ fullstatus >+ ERROR=$? >+ ;; >+ >+graceful) >+ configtest || exit 1 >+ /bin/systemctl reload apache2.service >+ ERROR=$? >+ ;; >+ >+gracefulstop|graceful-stop) >+ configtest || exit 1 >+ /bin/systemctl stop apache2.service >+ ERROR=$? >+ ;; >+ >+configtest) >+ configtest >+ ERROR=$? >+ ;; >+ >+checkconfd) >+ checkconfd >+ ERROR=$? >+ ;; >+ >+configdump) >+ configtest || exit 1 >+ configdump >+ ERROR=$? >+ ;; >+ >+virtualhosts) >+ configtest || exit 1 >+ ${APACHE2} ${APACHE2_OPTS} -S >+ ERROR=$? >+ ;; >+ >+modules) >+ configtest || exit 1 >+ ${APACHE2} ${APACHE2_OPTS} -M 2>&1 >+ ERROR=$? >+ ;; >+ >+# For all other options fall back to the legacy way of handling them >+*) >+ ${APACHE2} ${APACHE2_OPTS} "${@}" >+ ERROR=$? >+ ;; >+esac >+ >+exit $ERROR >-- >2.19.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 673530
: 570900