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