X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=debian%2Fpreinst;h=2dd6aa25f8b0e1059d52f130ec82b5126b2be314;hb=aae679876931f66cd7515636137bb1c7cc7473fb;hp=aaebc30ddfda7e3d10d9c082e098af402fe17d80;hpb=f4935d003256e973d6f192c392750f077339154a;p=grml-etc.git diff --git a/debian/preinst b/debian/preinst index aaebc30..2dd6aa2 100755 --- a/debian/preinst +++ b/debian/preinst @@ -4,16 +4,12 @@ # 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: Don Nov 02 20:58:57 CET 2006 [mika] +# Latest change: Mon Feb 04 15:32:00 CET 2008 [mika] ################################################################################ set -e -TO_DIVERT1="login.config mgetty.config" -TO_DIVERT2="ssh" -TO_DIVERT3="kismet.conf" -TO_DIVERT4="wlan-ng.conf" -TO_DIVERT5="windowlab.menurc" +TO_DIVERT1="ssh" divert_gen() { DEXT=${3:-original} @@ -21,6 +17,12 @@ divert_gen() { --divert $2/$1.$DEXT $2/$1 > /dev/null } +undivert_gen() { + DEXT=${3:-original} + dpkg-divert --remove --rename --package grml-etc \ + --divert $2/$1.$DEXT $2/$1 #> /dev/null +} + # move files from package grml-etc to grml-etc-core # and make sure we do not lose any files... rm_conffile() { @@ -28,9 +30,10 @@ rm_conffile() { if [ -e "$CONFFILE" ]; then md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" - old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`" + old_md5sum="`dpkg-query -W -f='${Conffiles}' grml-etc | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`" if [ "$md5sum" != "$old_md5sum" ]; then - echo "Conffile $CONFFILE has been modified, temporary moving to $CONFFILE.dpkg-bak ..." + echo "Obsolete conffile $CONFFILE has been modified by you." + echo "Saving as $CONFFILE.dpkg-bak ..." mv -f "$CONFFILE" "$CONFFILE".dpkg-bak fi fi @@ -39,34 +42,17 @@ rm_conffile() { case "$1" in install|upgrade) for cmd in $TO_DIVERT1; do - divert_gen $cmd /etc/mgetty - done - 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 - # did I mention that dpkg-divert sucks? - if [ -n "$2" ] ; then - if dpkg --compare-versions "${2}" lt 0.8 ; then - if dpkg-divert --list | grep -q /etc/init.d/postgresql-8.0 ; then - rm -f /etc/init.d/postgresql-8.0 - dpkg-divert --quiet --package grml-etc --remove --rename --divert /etc/init.d/postgresql-8.0.original /etc/init.d/postgresql-8.0 - fi - fi - fi + # Remove files we no longer ship + undivert_gen "kismet.conf" /etc/kismet + undivert_gen "wlan-ng.conf" /etc/pcmcia + undivert_gen "smb.conf" /etc/samba - # move files from package grml-etc to grml-etc-core / remove them at all + # move files from package grml-etc to grml-etc-core for file in /etc/zsh/zlogin /etc/zsh/zprofile /etc/zsh/zshenv /etc/zsh/zshrc \ - /etc/zsh/zshrc /etc/zsh/zlogout /etc/vim/vimrc /etc/samba/smb.conf ; do + /etc/zsh/zshrc /etc/zsh/zlogout /etc/vim/vimrc ; do if dpkg-divert --list $file | grep -q 'grml-etc$' ; then rm_conffile $file dpkg-divert --quiet --package grml-etc --remove --rename --divert $file.original $file @@ -84,6 +70,8 @@ case "$1" in exit 1 esac +#DEBHELPER# + exit 0 ## END OF FILE #################################################################