[Pkg-ocaml-maint-commits] [SCM] ocsigen packaging branch, master, updated. debian/1.2.1-1-8-g7a159d9

Stephane Glondu steph at glondu.net
Wed Oct 21 16:30:48 UTC 2009


The following commit has been merged in the master branch:
commit b1ca9858915eda40492ec5977a215f34caf747d8
Author: Stephane Glondu <steph at glondu.net>
Date:   Wed Oct 21 18:10:38 2009 +0200

    Handle /var/log/ocsigen in maintainer scripts

diff --git a/debian/ocsigen.install.in b/debian/ocsigen.install.in
index 3ed312e..e0fc137 100644
--- a/debian/ocsigen.install.in
+++ b/debian/ocsigen.install.in
@@ -5,4 +5,3 @@ usr/bin
 usr/share/man
 usr/share/ocsigen
 var/lib/ocsigen
-var/log/ocsigen
diff --git a/debian/ocsigen.postinst b/debian/ocsigen.postinst
index 6e13408..ae74efb 100644
--- a/debian/ocsigen.postinst
+++ b/debian/ocsigen.postinst
@@ -54,10 +54,24 @@ fi
 set +e
 
 ###
-# 4. Change ownership of directory.
+# 4.1 Change ownership of directory.
 $CHOWN -R $OCSIGEN:$OCSIGEN /var/lib/ocsigen/
 $CHMOD 750 /var/lib/ocsigen/
-$CHOWN -R $OCSIGEN:$OCSIGEN /var/log/ocsigen/
+
+###
+# 4.2 Create log directory and empty log if needed
+LOGDIR="/var/log/ocsigen"
+LOGFILE="${LOGDIR}/access.log"
+mkdir -p $LOGDIR
+$CHOWN $OCSIGEN:$OCSIGEN $LOGDIR
+$CHMOD 750 $LOGDIR
+if [ ! -f $LOGFILE ]; then
+    touch $LOGFILE
+    $CHOWN $OCSIGEN:$OCSIGEN $LOGFILE
+    $CHMOD 640 $LOGFILE
+fi
+# The empty log is a workaround to logrotate complaining about
+# inexistent logs (see #550324)
 
 ###
 # 5. Call update hooks
diff --git a/debian/ocsigen.postrm b/debian/ocsigen.postrm
new file mode 100644
index 0000000..f3a4cc1
--- /dev/null
+++ b/debian/ocsigen.postrm
@@ -0,0 +1,27 @@
+#!/bin/sh
+# postrm script for ocsigen
+
+set -e
+
+case "$1" in
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    purge)
+        if test -d /var/log/ocsigen; then
+          rm -Rf /var/log/ocsigen
+        fi
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

-- 
ocsigen packaging



More information about the Pkg-ocaml-maint-commits mailing list