]> git.decadent.org.uk Git - memories.git/commitdiff
Remove installation of Apache config fragment from rules.
authorBen Hutchings <ben@decadent.org.uk>
Wed, 11 Jan 2006 00:50:57 +0000 (00:50 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 11 Jan 2006 00:50:57 +0000 (00:50 +0000)
Add postinst script to add it to any Apache installation with mod_perl enabled.
Add postrm script to remove it later.

debian/memories.postinst [new file with mode: 0755]
debian/memories.postrm [new file with mode: 0755]
debian/rules

diff --git a/debian/memories.postinst b/debian/memories.postinst
new file mode 100755 (executable)
index 0000000..5393e1b
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+if [ "x$1" = xconfigure ]; then
+
+    # Install our configuration fragment and make Apache load it
+    # (and unload any code from a previous version of Memories).
+    # Check whether mod_perl is enabled first.
+    for server in apache apache-perl apache-ssl; do
+        if [ "$(apache-modconf $server query mod_perl 2>/dev/null)" \
+                 = "mod_perl" -a \
+             \! -e /etc/$server/conf.d/memories ]; then
+            ln -s ../../memories/apache.conf /etc/$server/conf.d/memories
+            invoke-rc.d $server force-reload
+        fi
+    done
+    # Module configuration is different in the apache2 package.
+    if [ -e /etc/apache2/mods-enabled/perl.load -a \
+         \! -e /etc/apache2/conf.d/memories ]; then
+        ln -s ../../memories/apache.conf /etc/apache2/conf.d/memories
+        invoke-rc.d apache2 force-reload
+    fi
+
+fi
diff --git a/debian/memories.postrm b/debian/memories.postrm
new file mode 100755 (executable)
index 0000000..0d3c14f
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ "x$1" = xremove -o "x$1" = xpurge ]; then
+    # Flush out our configuration fragment and loaded code from Apache.
+    for server in apache apache-perl apache-ssl apache2; do
+        if [ -L /etc/$server/conf.d/memories ]; then
+            rm /etc/$server/conf.d/memories
+            invoke-rc.d $server force-reload
+        fi
+    done
+fi
index 2573375c8f0f30ab92ea1890c8977fd6b9a9ac0a..348d96a3499b6e6ae777d14a3ee6eee6d4a4a070 100755 (executable)
@@ -16,8 +16,6 @@ binary-indep :
        cp -dR templates debian/memories/etc/memories/
        ln -s /etc/memories/Config.pm debian/memories/usr/share/perl5/Memories/
        install debian/apache.conf debian/memories/etc/memories/
-       install -d debian/memories/etc/apache/conf.d
-       ln -s ../../memories/apache.conf debian/memories/etc/apache/conf.d/memories
        install -d debian/memories/usr/share/memories
        install memories.sql tag_dates debian/memories/usr/share/memories/
        install -d debian/memories/var/lib/memories