public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2019-04-28 10:58 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2019-04-28 10:58 UTC (permalink / raw
  To: gentoo-commits

commit:     9725bbb3a9b403c37dbf64c73428d8074112a471
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 28 10:58:01 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sun Apr 28 10:58:01 2019 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=9725bbb3

apache2ctl: Minor improvements

Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 2.4/scripts/apache2ctl | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl
index 55975d4..872044b 100644
--- a/2.4/scripts/apache2ctl
+++ b/2.4/scripts/apache2ctl
@@ -8,7 +8,7 @@ RC_VERBS="start stop restart checkconfd configtest modules virtualhosts configdu
 
 
 is_systemd() {
-        [ $(ps -o comm= 1) = "systemd" ] && return 0
+        [ $(ps -o comm= -p 1) = "systemd" ] && return 0
         return 1
 }
 
@@ -109,8 +109,7 @@ else
 
 	# 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}"
+	APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT} -f ${CONFIGFILE}"
 
 	apache_service="apache2.service"
 


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2021-02-12 14:28 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2021-02-12 14:28 UTC (permalink / raw
  To: gentoo-commits

commit:     64371485b30887df6097de53f106803ecc746dae
Author:     Pacho Ramos <pachoramos <AT> gmail <DOT> com>
AuthorDate: Fri Feb 12 14:09:08 2021 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Fri Feb 12 14:26:22 2021 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=64371485

2.4/scripts/apache2-logrotate: handle systemd

Bug: https://bugs.gentoo.org/646032
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 2.4/scripts/apache2-logrotate | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/2.4/scripts/apache2-logrotate b/2.4/scripts/apache2-logrotate
index 9dd431c..5d9f8dc 100644
--- a/2.4/scripts/apache2-logrotate
+++ b/2.4/scripts/apache2-logrotate
@@ -1,11 +1,15 @@
 # Apache2 logrotate snipet for Gentoo Linux
-# Contributes by Chuck Short
+# Originally contributed by Chuck Short
 #
 /var/log/apache2/*log {
   missingok
   notifempty
   sharedscripts
   postrotate
-  /etc/init.d/apache2 reload > /dev/null 2>&1 || true
+  if test -d /run/systemd/system ; then
+	systemctl reload apache2.service > /dev/null 2>&1 || true
+  else
+	/etc/init.d/apache2 reload > /dev/null 2>&1 || true
+  fi
   endscript
 }


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2019-04-02  8:39 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2019-04-02  8:39 UTC (permalink / raw
  To: gentoo-commits

commit:     fcc7da95dd75910085a8c688b8ec5d25ba11bd1e
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  2 08:31:45 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Apr  2 08:39:12 2019 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=fcc7da95

Several fixes to previous apache2ctl systemd enhancement

- Attempt to keep the script POSIX sh compliant
- Don't use "function" prefix
- Use curly braces for variables
- Fixed indentation
- Put code for systemd into an "else" part
- Renamed "ERROR" variable to "retval"
- Made some variables local
- Put the systemd apache2 service file reference into a variable

Bug: https://bugs.gentoo.org/673530
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 2.4/scripts/apache2ctl | 198 ++++++++++++++++++++++++-------------------------
 1 file changed, 97 insertions(+), 101 deletions(-)

diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl
index 392ac4c..55975d4 100644
--- a/2.4/scripts/apache2ctl
+++ b/2.4/scripts/apache2ctl
@@ -1,18 +1,18 @@
 #!/bin/sh
 
 APACHE2="/usr/sbin/apache2"
-APACHE_OPTS=""
+APACHE2_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"
 
 
-function is_systemd() {
-        [ $(ps --no-headers -o comm 1) == "systemd" ] && return 0
+is_systemd() {
+        [ $(ps -o comm= 1) = "systemd" ] && return 0
         return 1
 }
 
-function load_rc_config() {
+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}"
@@ -20,12 +20,12 @@ function load_rc_config() {
         fi
         . ${APACHE_RC_CONF}
         export APACHE2_OPTS
-        export SERVERROOT="${SERVERROOT:-/usr/lib64/apache2}"
+        export SERVERROOT="${SERVERROOT:-/usr/@LIBDIR@/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() {
         RELOAD_TYPE="${RELOAD_TYPE:-graceful}"
 
         if [ "${RELOAD_TYPE}" = "restart" ]; then
@@ -33,12 +33,12 @@ function reload() {
         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"
+                echo "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit ${APACHE_RC_CONF}"
         fi
 }
 
 # Basically the code from '/etc/init.d/apache2::fullstatus()', updated to run without open-rc
-function fullstatus() {
+fullstatus() {
         LYNX="${LYNX:-lynx -dump}"
         STATUSURL="${STATUSURL:-http://localhost/server-status}"
 
@@ -51,35 +51,37 @@ function fullstatus() {
 }
 
 # Basically the code from '/etc/init.d/apache2::checkconfd()', updated to run without open-rc
-function checkconfd() {
-        if [ ! -d ${SERVERROOT} ]; then
+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() {
+configtest() {
         checkconfd || return 1
 
-        OUTPUT=$( ${APACHE2} ${APACHE2_OPTS} -t 2>&1 )
+        local ret
+        OUTPUT="$(${APACHE2} ${APACHE2_OPTS} -t 2>&1)"
         ret=$?
-        if [ $ret -ne 0 ]; then
+        if [ ${ret} -ne 0 ]; then
                 echo "apache2 has detected an error in your setup:"
                 printf "%s\n" "${OUTPUT}"
         fi
 
-        return $ret
+        return ${ret}
 }
 
 # Basically the code from '/etc/init.d/apache2::configdump()', updated to run without open-rc
-function configdump() {
+configdump() {
         INFOURL="${INFOURL:-http://localhost/server-info}"
 
-        if ! command -v $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
+        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}'"
+                local i
                 for i in config server list; do
                         ${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q'
                 done
@@ -87,90 +89,84 @@ function configdump() {
 }
 
 
-# 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
+	# If systemd IS NOT detected, run the legacy apache2ctl code
+
+	# 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
+else
+	# If systemd IS detected, load the config and parse the argument
+
+	# Yes, we load config from apache's openrc conf.d file.
+	# Feel free to provide a more suitable solution.
+	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}"
+
+	apache_service="apache2.service"
+
+	case ${1} in
+		# Original apachectl options
+		# See: https://httpd.apache.org/docs/2.4/programs/apachectl.html
+		start|stop|restart|status)
+			systemctl ${1} ${apache_service}
+			retval=$?
+		;;
+		reload)
+			reload
+			retval=$?
+		;;
+		fullstatus)
+			fullstatus
+			retval=$?
+		;;
+		graceful)
+			configtest || exit 1
+			systemctl reload ${apache_service}
+			retval=$?
+		;;
+		gracefulstop|graceful-stop)
+			configtest || exit 1
+			systemctl stop ${apache_service}
+			retval=$?
+		;;
+		configtest)
+			configtest
+			retval=$?
+		;;
+		checkconfd)
+			checkconfd
+			retval=$?
+		;;
+		configdump)
+			configtest || exit 1
+			configdump
+			retval=$?
+		;;
+		virtualhosts)
+			configtest || exit 1
+			${APACHE2} ${APACHE2_OPTS} -S
+			retval=$?
+		;;
+		modules)
+			configtest || exit 1
+			${APACHE2} ${APACHE2_OPTS} -M 2>&1
+			retval=$?
+		;;
+		# For all other options fall back to the legacy way of handling them
+		*)
+			${APACHE2} ${APACHE2_OPTS} "${@}"
+			retval=$?
+		;;
+	esac
+	exit ${retval}
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2019-04-02  8:39 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2019-04-02  8:39 UTC (permalink / raw
  To: gentoo-commits

commit:     74a5571d7fdae809663b0c16db2edb6aa9f8d42f
Author:     Jarod <jarodiv <AT> web <DOT> de>
AuthorDate: Tue Mar 26 22:27:31 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Apr  2 08:38:30 2019 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=74a5571d

apache2ctl: Add suport for systemd

Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2019-02-26 15:42 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2019-02-26 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     88b2946f6ef88c1f99ceb63775c0173935d34af5
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 26 15:38:15 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Feb 26 15:39:19 2019 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=88b2946f

apache2ctl: don't fail with mutli-line APACHE2_OPTS in conf.d file.

Bug: https://bugs.gentoo.org/676990
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 2.4/scripts/apache2ctl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl
index 6f5920d..9012520 100644
--- a/2.4/scripts/apache2ctl
+++ b/2.4/scripts/apache2ctl
@@ -8,9 +8,12 @@ RC_VERBS="start stop restart checkconfd configtest modules virtualhosts configdu
 
 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})
+	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}"
 }


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2019-02-26 15:42 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2019-02-26 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     02437d8a3c0a83d2e20af8f05f071233ad1d3339
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 26 15:40:26 2019 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Feb 26 15:41:28 2019 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=02437d8a

apache2ctl: Don't show grep usage message with leading "-" options.

Thanks-to: Freenode IRC-user "omelius"
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 2.4/scripts/apache2ctl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl
index 9012520..8031b8b 100644
--- a/2.4/scripts/apache2ctl
+++ b/2.4/scripts/apache2ctl
@@ -20,7 +20,7 @@ load_rc_config() {
 
 # 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
+if echo "${RC_VERBS}" | grep -q -- "${1}" ; then
 	exec /etc/init.d/apache2 "${@}"
 else
 	load_rc_config || exit 1


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2018-03-23 16:22 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2018-03-23 16:22 UTC (permalink / raw
  To: gentoo-commits

commit:     04a0e8d110f76f7e432e32ecf87a81be83e5cf9b
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 23 16:16:16 2018 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Fri Mar 23 16:20:10 2018 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=04a0e8d1

2.4/scripts/apache2ctl: POSIX shells don't know =~ test operator.

Fixed by using "echo ... | grep -q ..." combination.

Gentoo-Bug: https://bugs.gentoo.org/650678

 2.4/scripts/apache2ctl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl
index 2c7c699..6f5920d 100644
--- a/2.4/scripts/apache2ctl
+++ b/2.4/scripts/apache2ctl
@@ -17,7 +17,7 @@ load_rc_config() {
 
 # 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
+if echo "${RC_VERBS}" | grep -q "${1}" ; then
 	exec /etc/init.d/apache2 "${@}"
 else
 	load_rc_config || exit 1


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/apache:master commit in: 2.4/scripts/
@ 2018-03-15 10:11 Lars Wendler
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2018-03-15 10:11 UTC (permalink / raw
  To: gentoo-commits

commit:     9e3d349cc1ee14e91d377b6a38c786ac4b153fe5
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 15 10:07:38 2018 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Thu Mar 15 10:09:38 2018 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=9e3d349c

2.4/scripts/apache2ctl: Pass commands to the apache daemon.

Gentoo-Bug: https://bugs.gentoo.org/634414

Thanks-to: Joona Hoikkala <joona <AT> kuori.org>
Thanks-to: Andrey Falko <Ma3oxuct <AT> gmail.com>

 2.4/scripts/apache2ctl | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/2.4/scripts/apache2ctl b/2.4/scripts/apache2ctl
old mode 100755
new mode 100644
index eff10b5..2c7c699
--- 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-12 14:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-28 10:58 [gentoo-commits] proj/apache:master commit in: 2.4/scripts/ Lars Wendler
  -- strict thread matches above, loose matches on Subject: below --
2021-02-12 14:28 Lars Wendler
2019-04-02  8:39 Lars Wendler
2019-04-02  8:39 Lars Wendler
2019-02-26 15:42 Lars Wendler
2019-02-26 15:42 Lars Wendler
2018-03-23 16:22 Lars Wendler
2018-03-15 10:11 Lars Wendler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox