commit:     db9bc13b034e1dcca1765dbf0e2a7efcc1b6d3ba
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  1 12:07:58 2020 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Tue Dec  1 12:12:40 2020 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=db9bc13b

2.4/init: Attempt to provide a way to no longer "need net" in depend

Code blatantly stolen from net-misc/openssh init script

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

 2.4/init/apache2.initd | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/2.4/init/apache2.initd b/2.4/init/apache2.initd
index b0be24a..941dad9 100755
--- a/2.4/init/apache2.initd
+++ b/2.4/init/apache2.initd
@@ -33,9 +33,24 @@ APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}"
 APACHE2="/usr/sbin/apache2"
 
 depend() {
-       need net
        use dns entropy logger mysql netmount postgresql
        after sshd
+       if ! echo ${rc_need} | grep -Fq "net." ; then
+               local x warn_addr
+               for x in $(virtualhosts | grep '^\(\[\|\)[[:digit:]]' | sed 
's@\(:[[:digit:]]\{1,5\}\)\([[:space:]].*\|$\)@\1@' | sort -u) ; do
+                       case "${x}" in
+                               \*:80|\*.443) ;;
+                               *) warn_addr="${warn_addr} ${x}" ;;
+                       esac
+               done
+               if [ -n "${warn_addr}" ] ; then
+                       need net
+                       ewarn "You are binding an interface in you virtual 
hosts."
+                       ewarn "You must add rc_need=\"net.FOO\" to your 
${RC_PREFIX%/}/etc/conf.d/apache2"
+                       ewarn "where FOO is the interface(s) providing the 
following address(es):"
+                       ewarn "${warn_addr}"
+               fi
+       fi
 }
 
 configtest() {

Reply via email to