From 34172d87ef01b4c015f66b06d5088ae7d1d2d0b9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 20 Mar 2008 22:47:24 -0400 Subject: transition code --- debian/preinst | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'debian/preinst') diff --git a/debian/preinst b/debian/preinst index 3b927e4..80ed595 100644 --- a/debian/preinst +++ b/debian/preinst @@ -18,23 +18,23 @@ prep_mv_conffile() { } # Remove a no-longer used conffile -#rm_conffile() { -# PKGNAME="$1" -# CONFFILE="$2" -# -# if [ -e "$CONFFILE" ]; then -# md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" -# old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | 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 ..." -# mv -f "$CONFFILE" "$CONFFILE".dpkg-bak -# else -# echo "Removing obsolete conffile $CONFFILE ..." -# rm -f "$CONFFILE" -# fi -# fi -#} +rm_conffile() { + PKGNAME="$1" + CONFFILE="$2" + + if [ -e "$CONFFILE" ]; then + md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" + old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | 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 ..." + mv -f "$CONFFILE" "$CONFFILE".dpkg-bak + else + echo "Removing obsolete conffile $CONFFILE ..." + rm -f "$CONFFILE" + fi + fi +} case "$1" in install|upgrade) @@ -56,4 +56,12 @@ install|upgrade) done fi + if dpkg --compare-versions "$2" le "0.13"; then + for c in 20store-empty-directory 40rm-old-metadata; do + rm_conffile etckeeper "/etc/etckeeper/pre-commit.d/$c" + done + for c in 10restore-etckeeper 20restore-metadata; do + prep_mv_conffile etckeeper "/etc/etckeeper/init.d/$c" + done + fi esac -- cgit v1.2.3