# 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: Don Nov 02 20:58:57 CET 2006 [mika]
+# Latest change: Mon Feb 04 15:32:00 CET 2008 [mika]
################################################################################
set -e
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
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
fi
fi
- # 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
dpkg-divert --quiet --package grml-etc --remove --rename --divert /etc/skel/.zshrc.original /etc/skel/.zshrc
fi
+ if dpkg-divert --list /etc/samba/smb.conf | grep -q 'grml-etc$' ; then
+ [ -f /etc/samba/smb.conf.original ] && rm /etc/samba/smb.conf.original
+ dpkg-divert --quiet --package grml-etc --remove --rename --divert /etc/samba/smb.conf.original /etc/samba/smb.conf
+ fi
+
;;
*)
echo "preinst called with unknown argument $1" >&2