systemd: start apache after postgresql
authorIvan Kohler <ivan@freeside.biz>
Mon, 15 Jul 2024 21:04:10 +0000 (14:04 -0700)
committerIvan Kohler <ivan@freeside.biz>
Mon, 15 Jul 2024 21:24:54 +0000 (14:24 -0700)
Makefile
debian/freeside-webui.dirs [new file with mode: 0644]
debian/freeside-webui.postinst
debian/rules
init.d/insserv-override-apache2 [deleted file]
init.d/systemd-apache-override.conf [new file with mode: 0644]

index 5441747..7774754 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -77,13 +77,8 @@ HTTPD_RESTART = /etc/init.d/apache2 restart
 #HTTPD_RESTART = /usr/local/apache/bin/apachectl stop; sleep 10; /usr/local/apache/bin/apachectl startssl
 
 #(an include directory, not a file, "Include /etc/apache/conf.d" in httpd.conf)
-#deb (3.1+), apache2
-#APACHE_CONF = /etc/apache2/conf.d
 #debian unstable/8.0+, apache2.4
-#APACHE_CONF = /etc/apache2/conf-available
-APACHE_CONF := $(shell [ ${APACHE_VERSION} = '2.4' ] && echo '/etc/apache2/conf-available' || echo '/etc/apache2/conf.d')
-
-INSSERV_OVERRIDE = /etc/insserv/overrides
+APACHE_CONF = /etc/apache2/conf-available
 
 FREESIDE_RESTART = ${INIT_FILE} restart
 
@@ -300,10 +295,11 @@ install-apache:
              s'%%%MASON_HANDLER%%%'${MASON_HANDLER}'g; \
            " ${APACHE_CONF}/freeside-*.conf \
          ) || true
-       [ -d ${APACHE_CONF} ] && [ -x /usr/sbin/a2enconf ] && ( /usr/sbin/a2enconf freeside-base${APACHE_VERSION} ) || true
-       [ -d ${APACHE_CONF} ] && [ ${APACHE_VERSION} = '2.4' ] && [ -x /usr/sbin/a2disconf ] && ( /usr/sbin/a2disconf freeside-base2 ) || true
+       [ -d ${APACHE_CONF} ] && [ -x /usr/sbin/a2enconf ] && ( /usr/sbin/a2enconf freeside-base2.4 ) || true
+       [ -d ${APACHE_CONF} ] && [ -x /usr/sbin/a2disconf ] && ( /usr/sbin/a2disconf freeside-base2 ) || true
        [ -d ${APACHE_CONF} ] && [ -x /usr/sbin/a2enconf ] && [ ${RT_ENABLED} -eq 1 ] && ( /usr/sbin/a2enconf freeside-rt ) || true
-       [ -d ${INSSERV_OVERRIDE} ] && [ -x /sbin/insserv ] && ( install -o root -m 755 init.d/insserv-override-apache2 ${INSSERV_OVERRIDE}/apache2 && insserv -d ) || true
+       [ -x /usr/sbin/systemctl ] && mkdir /etc/systemd/system/apache.d/ || true
+       [ -x /usr/sbin/systemctl ] && ( install -o root -m 755 init.d/systemd-apache-override.conf /etc/systemd/system/apache2.d/override.conf && /usr/sbin/systemctl daemon-reload ) || true
 
 install-selfservice:
        [ -e ~freeside ] || cp -pr /etc/skel ~freeside && chown -R freeside ~freeside
diff --git a/debian/freeside-webui.dirs b/debian/freeside-webui.dirs
new file mode 100644 (file)
index 0000000..216d42d
--- /dev/null
@@ -0,0 +1,2 @@
+/usr/local/etc/freeside/profile
+/etc/systemd/system/apache2.d
index 8dd2baa..50bdff2 100644 (file)
@@ -3,8 +3,12 @@
 chown -R freeside /usr/local/etc/freeside
 rm -fr  /usr/local/etc/freeside/masondata/*
 
-#XXX systemd equivalent (start apache after postgres)
-/sbin/insserv -d
+/usr/sbin/a2dismod mpm_event || /bin/true
+/usr/sbin/a2dismod mpm_worker || /bin/true
+/usr/sbin/a2enmod mpm_prefork
+#/usr/sbin/service restart apache2
+
+/usr/bin/systemctl daemon-reload
 
 exit 0
 
index 867324d..ed8c6ca 100755 (executable)
@@ -133,7 +133,7 @@ install-stamp: build-stamp
 
        install -d $(FREESIDE_DOCUMENT_ROOT)
        install -d $(TMP)-webui/usr/local/etc/freeside/
-       install -d $(TMP)-webui/etc/insserv/overrides/
+       install -d $(TMP)-webui/etc/systemd/system/apache2.d/
        install -d $(TMP)/usr/local/etc/freeside/
        install -d $(FREESIDE_CACHE)/masondata #MASONDATA
 #      install -d $(TMP)-lib/usr/bin
@@ -176,7 +176,7 @@ install-stamp: build-stamp
        # Create Apache configurations
        install -d $(APACHE_CONF)
        $(MAKE) -e DESTDIR=$(APACHE_CONF) install-apache
-       install -o root -m 755 init.d/insserv-override-apache2 $(TMP)-webui/etc/insserv/overrides/apache2
+       install -o root -m 755 init.d/systemd-apache-override.conf $(TMP)-webui/etc/systemd/system/apache2.d/override.conf
 
         #Hack the build dir out of apache config
 
diff --git a/init.d/insserv-override-apache2 b/init.d/insserv-override-apache2
deleted file mode 100644 (file)
index 1b333e8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-### BEGIN INIT INFO
-# Provides:          apache2
-# Required-Start:    $local_fs $remote_fs $network $syslog $named
-# Required-Stop:     $local_fs $remote_fs $network $syslog $named
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# X-Interactive:     true
-# Short-Description: Start/stop apache2 web server
-# Should-Start:      postgresql mysql
-# Should-Stop:       postgresql mysql
-### END INIT INFO
diff --git a/init.d/systemd-apache-override.conf b/init.d/systemd-apache-override.conf
new file mode 100644 (file)
index 0000000..ad478e1
--- /dev/null
@@ -0,0 +1,2 @@
+[Unit]
+After=postgresql.service