Bug#860087: Please add and enable systemd module
Source: apache2
Version: 2.4.63-1
Followup-For: Bug #860087
X-Debbugs-Cc: Marco d'Itri <md@Linux.IT>
Hello,
Please find here a patch to fix this.
The module is builtin as it's required by the .service to properly start
apache.
Kind regards,
Laurent Bigonville
-- System Information:
Debian Release: 13.0
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 6.15-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8), LANGUAGE=fr_BE:fr
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff --git a/debian/apache2.service b/debian/apache2.service
index cd7e663c..1491eb1f 100644
--- a/debian/apache2.service
+++ b/debian/apache2.service
@@ -4,7 +4,7 @@ After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/
[Service]
-Type=forking
+Type=notify
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl graceful-stop
diff --git a/debian/apache2@.service b/debian/apache2@.service
index 56f88cc7..568c3376 100644
--- a/debian/apache2@.service
+++ b/debian/apache2@.service
@@ -5,7 +5,7 @@ ConditionPathIsDirectory=/etc/apache2-%i
Documentation=https://httpd.apache.org/docs/2.4/
[Service]
-Type=forking
+Type=notify
Environment=APACHE_CONFDIR=/etc/apache2-%i APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl graceful-stop
diff --git a/debian/apache2ctl b/debian/apache2ctl
index cde76619..a13a66ec 100755
--- a/debian/apache2ctl
+++ b/debian/apache2ctl
@@ -175,7 +175,7 @@ start)
systemctl start "$APACHE_SYSTEMD_SERVICE"
else
unset APACHE_STARTED_BY_SYSTEMD
- $HTTPD ${APACHE_ARGUMENTS} -k "$ARGV"
+ exec $HTTPD ${APACHE_ARGUMENTS} -k "$ARGV" -DFOREGROUND
fi
ERROR=$?
diff --git a/debian/control b/debian/control
index 2412668e..a33dd7d8 100644
--- a/debian/control
+++ b/debian/control
@@ -22,6 +22,7 @@ Build-Depends: debhelper-compat (= 13),
libnghttp2-dev,
libpcre2-dev,
libssl-dev,
+ libsystemd-dev [linux-any],
libxml2-dev,
lsb-release,
perl,
diff --git a/debian/rules b/debian/rules
index e005628f..ba820f1a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,6 +21,14 @@ AP2_LDFLAGS = -Wl,--as-needed $(LDFLAGS)
AP2_CPPFLAGS = -DPLATFORM='\"$(LSB_RELEASE)\"' -DBUILD_DATETIME='\"$(BUILD_DATETIME)\"' $(CPPFLAGS)
AP2_LTFLAGS = --no-silent
+ifeq "$(DEB_BUILD_ARCH_OS)" "linux"
+ENABLE_SYSTEMD_MOD := --enable-systemd
+SYSTEMD_MOD := systemd
+else
+ENABLE_SYSTEMD_MOD := --disable-systemd
+SYSTEMD_MOD :=
+endif
+
support/suexec-custom.c: support/suexec.c debian/patches/suexec-custom.patch
cp support/suexec.c support/suexec-custom.c
patch -p1 -i debian/patches/suexec-custom.patch
@@ -112,10 +120,10 @@ configure-stamp: prebuild-checks-stamp support/suexec-custom.c
--with-suexec-uidmin=100 --enable-suexec=shared --enable-log-config=static \
--with-apr=/usr/bin/apr-1-config --with-apr-util=/usr/bin/apu-1-config \
--with-pcre=/usr/bin/pcre2-config \
- --enable-pie \
+ --enable-pie $(ENABLE_SYSTEMD_MOD) \
--enable-mpms-shared=all \
--enable-mods-shared="all brotli cgi ident authnz_fcgi imagemap cern_meta proxy_fdpass proxy_http2 bucketeer case_filter case_filter_in" \
- --enable-mods-static="unixd logio watchdog version" \
+ --enable-mods-static="unixd logio watchdog version $(SYSTEMD_MOD)" \
CFLAGS="$(AP2_CFLAGS)" CPPFLAGS="$(AP2_CPPFLAGS)" LDFLAGS="$(AP2_LDFLAGS)" \
LTFLAGS="$(AP2_LTFLAGS)" SHELL=/bin/bash GREP=/bin/grep
touch $@
Reply to: