Try to work around dpkg-divert issues with missing files 1.1.2
authorMichael Prokop <mika@grml.org>
Mon, 4 Feb 2008 14:33:03 +0000 (15:33 +0100)
committerMichael Prokop <mika@grml.org>
Mon, 4 Feb 2008 14:33:03 +0000 (15:33 +0100)
debian/changelog
debian/preinst

index 27fb51a..ab659c6 100644 (file)
@@ -1,3 +1,9 @@
+grml-etc (1.1.2) unstable; urgency=low
+
+  * Try to work around dpkg-divert issues with missing files.
+
+ -- Michael Prokop <mika@grml.org>  Mon, 04 Feb 2008 15:32:27 +0100
+
 grml-etc (1.1.1) unstable; urgency=low
 
   * Fix the "grml 1.1-rc1 does not open the CD-ROM tray on reboot/halt"
index da3ff00..ba60baa 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Mit Jul 04 12:31:26 CEST 2007 [mika]
+# Latest change: Mon Feb 04 15:32:00 CET 2008 [mika]
 ################################################################################
 
 set -e
@@ -28,10 +28,10 @@ rm_conffile() {
 
     if [ -e "$CONFFILE" ]; then
         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
-       old_md5sum="`dpkg-query -W -f='${Conffiles}' grml-etc | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' grml-etc | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
         if [ "$md5sum" != "$old_md5sum" ]; then
             echo "Obsolete conffile $CONFFILE has been modified by you."
-           echo "Saving as $CONFFILE.dpkg-bak ..."
+            echo "Saving as $CONFFILE.dpkg-bak ..."
             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
         fi
     fi
@@ -39,21 +39,29 @@ rm_conffile() {
 
 case "$1" in
    install|upgrade)
-        for cmd in $TO_DIVERT1; do
-                divert_gen $cmd /etc/mgetty
-        done
+        if [ -r /etc/mgetty/login.config ] ; then
+           for cmd in $TO_DIVERT1; do
+               divert_gen $cmd /etc/mgetty
+           done
+        fi
         for cmd in $TO_DIVERT2; do
-                divert_gen $cmd /etc/init.d
-        done
-        for cmd in $TO_DIVERT3; do
-                divert_gen $cmd /etc/kismet
-        done
-        for cmd in $TO_DIVERT4; do
-                divert_gen $cmd /etc/pcmcia
-        done
-        for cmd in $TO_DIVERT5; do
-                divert_gen $cmd /etc/X11/windowlab
+            divert_gen $cmd /etc/init.d
         done
+        if [ -d /etc/kismet ] ; then
+           for cmd in $TO_DIVERT3; do
+               divert_gen $cmd /etc/kismet
+           done
+        fi
+        if [ -d /etc/pcmcia ] ; then
+           for cmd in $TO_DIVERT4; do
+               divert_gen $cmd /etc/pcmcia
+           done
+        fi
+        if [ -d /etc/X11/windowlab ] ; then
+           for cmd in $TO_DIVERT5; do
+               divert_gen $cmd /etc/X11/windowlab
+           done
+        fi
 
         # did I mention that dpkg-divert sucks?
         if [ -n "$2" ] ; then