1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
# common.functions.postinst start
# $Id: common.functions.postinst 3943 2009-05-22 12:11:09Z preining $
handle_config_file_postinst()
{
# this function handles two things: It moves conffiles to their
# new place if they had been changed, and it ignores the possible
# removal of the conffile because of bug #420390, fixing upgrades
# from etch.
#
# Note that the consequences of this bug for users of sid are
# dealt with separately, in the function resurrect_conffile_sid()
# which is only called for the critical conffiles.
cfgfile="$1"
action="$2"
version="$3"
case "$action" in
configure) # not reconfigure
if dpkg --compare-versions "$version" ge 2007; then
return 0
fi
;;
*)
return 0
;;
esac
if [ -f "$cfgfile.preinst-deleted" ]; then
echo "It looks like $cfgfile has been removed."
echo "In most cases this is a consequence of bug #420390."
echo "We are reinstatiating this config file."
echo "If you *really* want this to be removed, do it again,"
echo "but beware of the consequences."
echo ""
#mv "$cfgfile" "$cfgfile.dpkg-new"
rm "$cfgfile.preinst-deleted"
fi
if [ -f "$cfgfile.preinst-copy" ]; then
echo "Preserving user changes to $cfgfile"
# this only works as intended as long as the shipped version
# does not change!
mv -f "$cfgfile" "$cfgfile.dpkg-new"
mv -f "$cfgfile.preinst-copy" "$cfgfile"
fi
}
resurrect_conffile_sid(){
cfgfile="$1"
package="$2"
template_source="/usr/share/$package"
basefile=$(basename $cfgfile)
dirname=$(dirname $cfgfile)
if ! [ -f "$cfgfile" ]; then
mkdir -p $dirname
echo "Reinstalling deleted mandatory conffile $basefile" >&2
cp $template_source/$basefile $cfgfile
fi
}
# common.functions.postinst end
# Local Variables:
# mode: shell-script
# End:
# vim:set expandtab: #
|