7
# Remove a no-longer used conffile
11
# If the argument was not listed as a conffile, silently do nothing.
12
# Adapted from code obtained from http://wiki.debian.org/DpkgConffileHandling
13
eliminate_conffile() {
17
if [ -e "$CONFFILE" ]; then
18
CURRENT_MD5SUM="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
19
FACTORY_MD5SUM="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
20
if [ "$CURRENT_MD5SUM" != "$FACTORY_MD5SUM" ]; then
21
echo "Obsolete conffile $CONFFILE has been modified by you."
22
echo "Saving as $CONFFILE.dpkg-old ..."
23
mv -f "$CONFFILE" "$CONFFILE".dpkg-old
25
echo "Removing unmodified and obsolete conffile $CONFFILE ..."
31
# Compares a file to the "factory md5sum", and if it matches, removes it.
32
# This is useful for when converting from to a conffile *and* changing its contents
34
convert_to_conffile() {
38
if [ -e "$CONFFILE" ]; then
39
CURRENT_MD5SUM="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
40
if [ "$CURRENT_MD5SUM" = "$FACTORY_MD5SUM" ]; then
49
# /etc/init.d/stop-bootlogd used to be a symlink to bootlogd;
50
# now it is a separate script. We need to remove the symlink here,
51
# before dpkg installs the /etc/init.d/stop-bootlogd file.
53
[ -L /etc/init.d/stop-bootlogd ] && rm -f /etc/init.d/stop-bootlogd
55
# Remove obsolete conffiles
57
if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-10" ; then
58
eliminate_conffile "/etc/init.d/bootclean.sh"
61
# The /etc/init.d/bootclean script fragment was moved to
62
# /lib/init/ in version 2.86.ds1-39
64
if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-54" ; then
65
eliminate_conffile "/etc/init.d/bootclean"
68
# The /etc/init.d/waitnfs.sh script was replaced by mountnfs.sh
70
if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-56ubuntu1" ; then
71
eliminate_conffile "/etc/init.d/waitnfs.sh"
74
# The /etc/init.d/rc.local was made a conffile in 2.86.ds1-18, which for Ubuntu
75
# translates into "on upgrades to Intrepid and onwards". The only valid upgrade
76
# path to Intrepid is from Hardy, so we just check against the md5sum from there.
78
if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-18" ; then
79
convert_to_conffile "/etc/init.d/rc.local" e3756487011471f7753d5d94ce4b6af4
82
# Move conflicting log _file_ if present
84
[ -f /var/log/fsck ] && mv -f /var/log/fsck /var/log/fsck.dpkg-old