[Pkg-corba-commits] r171 - in /trunk/omniorb4/debian: omniorb-nameserver.postinst omniorb-nameserver.postrm omniorb-nameserver.preinst

flub-guest at users.alioth.debian.org flub-guest at users.alioth.debian.org
Sat May 17 10:50:53 UTC 2008


Author: flub-guest
Date: Sat May 17 10:50:53 2008
New Revision: 171

URL: http://svn.debian.org/wsvn/pkg-corba/?sc=1&rev=171
Log:
postrm: Only handle purge; remove logfile and database.
postinst: If this is the first time the package is installed see if
          there is a database to move to the new location.

Added:
    trunk/omniorb4/debian/omniorb-nameserver.postinst
Removed:
    trunk/omniorb4/debian/omniorb-nameserver.preinst
Modified:
    trunk/omniorb4/debian/omniorb-nameserver.postrm

Added: trunk/omniorb4/debian/omniorb-nameserver.postinst
URL: http://svn.debian.org/wsvn/pkg-corba/trunk/omniorb4/debian/omniorb-nameserver.postinst?rev=171&op=file
==============================================================================
--- trunk/omniorb4/debian/omniorb-nameserver.postinst (added)
+++ trunk/omniorb4/debian/omniorb-nameserver.postinst Sat May 17 10:50:53 2008
@@ -1,0 +1,48 @@
+#! /bin/sh
+# postinst script for omniorb-nameserver
+
+set -e
+
+LIBDIR=/var/lib/omniorb/
+OLDLIBDIR=/var/lib/omniorb4/
+ETCHLIBDIR=/var/log/
+DBFILE=omninames-$(uname -n).log
+BAKFILE=omninames-$(uname -n).log
+
+
+# Check a *LIBDIR for $DBFILE and $BAKFILE, move them if it is safe.
+# $1 - *LIBDIR to check.
+maybe_move_db() {
+    if [ -f $1/$DBFILE -a ! -f $LIBDIR/$DBFILE ]; then
+        mv $1/$DBFILE $LIBDIR/$DBFILE
+    fi
+    if [ -f $1/$BAKFILE -a ! -f $LIBDIR/$BAKFILE ]; then
+        mv $1/$BAKFILE $LIBDIR/$BAKFILE
+    fi
+}
+
+
+case "$1" in
+    configure)
+        # Only move the DB if we haven't been installed before.
+        if [ x$2 = x ]; then
+            maybe_move_db $ETCHLIBDIR
+            maybe_move_db $OLDLIBDIR
+            rmdir $OLDLIBDIR || /bin/true
+        fi
+        ;;
+    abort-upgrade|abort-remove|abort-deconfigure)
+        /bin/true
+        ;;
+    *)
+        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

Modified: trunk/omniorb4/debian/omniorb-nameserver.postrm
URL: http://svn.debian.org/wsvn/pkg-corba/trunk/omniorb4/debian/omniorb-nameserver.postrm?rev=171&op=diff
==============================================================================
--- trunk/omniorb4/debian/omniorb-nameserver.postrm (original)
+++ trunk/omniorb4/debian/omniorb-nameserver.postrm Sat May 17 10:50:53 2008
@@ -5,34 +5,13 @@
 
 LIBDIR=/var/lib/omniorb/
 LOGFILE=/var/log/omniorb-nameserver.log
-OLDLIBDIR=/var/log/
-DBFILE=$(uname -n).log
-BAKFILE=$(uname -n).bak
 
 case "$1" in
     purge)
         rm -rf $LIBDIR  || /bin/true
         rm -f $LOGFILE || /bin/true
         ;;
-    abort-install|abort-upgrade)
-        # The DB files could have been moved, move them back.
-        # See preinst script for more details.
-        case $2 in
-            4.0.6-*|4.0.7-*)
-                if [ -f $LIBDIR/$DBFILE ]; then
-                    mv $LIBDIR/$DBFILE $OLDLIBDIR/$DBFILE
-                fi
-                if [ -f $LIBDIR/$BAKFILE ]; then
-                    mv $LIBDIR/$BAKFILE $OLDLIBDIR/$BAKFILE
-                fi
-                rmdir $LIBDIR || /bin/true
-                ;;
-            *)
-                /bin/true
-                ;;
-        esac
-        ;;
-    remove|upgrade|failed-upgrade|disappear)
+    abort-install|remove|upgrade|abort-upgrade|failed-upgrade|disappear)
         /bin/true
         ;;
     *)




More information about the Pkg-corba-commits mailing list