home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / initscripts.preinst < prev    next >
Encoding:
Text File  |  2012-03-27  |  1.6 KB  |  66 lines

  1. #! /bin/sh
  2. #
  3. # initscripts preinst
  4. #
  5.  
  6. set -e
  7.  
  8. # Remove a no-longer used conffile
  9. #
  10. # $1: conffile
  11. #
  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() {
  15.     PKGNAME="initscripts"
  16.     CONFFILE="$1"
  17.  
  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
  25.         else
  26.             echo "Removing unmodified and obsolete conffile $CONFFILE ..."
  27.             rm -f "$CONFFILE"
  28.         fi
  29.     fi
  30. }
  31.  
  32. case "$1" in
  33.   install|upgrade)
  34.     #
  35.     # /etc/init.d/stop-bootlogd used to be a symlink to bootlogd;
  36.     # now it is a separate script.  We need to remove the symlink here,
  37.     # before dpkg installs the /etc/init.d/stop-bootlogd file.
  38.     #
  39.     [ -L /etc/init.d/stop-bootlogd ] && rm -f /etc/init.d/stop-bootlogd
  40.     #
  41.     # Remove obsolete conffiles
  42.     #
  43.     if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-10" ; then
  44.         eliminate_conffile "/etc/init.d/bootclean.sh"
  45.     fi
  46.     #
  47.     # The /etc/init.d/bootclean script fragment was moved to
  48.     # /lib/init/ in version 2.86.ds1-39
  49.     #
  50.     if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-54" ; then
  51.         eliminate_conffile "/etc/init.d/bootclean"
  52.     fi
  53.     #
  54.     # Move conflicting log _file_ if present
  55.     #
  56.     [ -f /var/log/fsck ] && mv -f /var/log/fsck /var/log/fsck.dpkg-old
  57.     ;;
  58.   abort-upgrade)
  59.     exit 0
  60.     ;;
  61. esac
  62.  
  63.  
  64.  
  65. :
  66.