From daf50715176f722b7837a839689ca525d697602a Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 4 Feb 2008 15:33:03 +0100 Subject: [PATCH] Try to work around dpkg-divert issues with missing files --- debian/changelog | 6 ++++++ debian/preinst | 40 ++++++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 27fb51a..ab659c6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +grml-etc (1.1.2) unstable; urgency=low + + * Try to work around dpkg-divert issues with missing files. + + -- Michael Prokop 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" diff --git a/debian/preinst b/debian/preinst index da3ff00..ba60baa 100755 --- a/debian/preinst +++ b/debian/preinst @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # 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 -- 2.1.4