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 / consolekit.preinst < prev    next >
Encoding:
Text File  |  2010-02-24  |  1.7 KB  |  70 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. # This script can be called in the following ways:
  6. #
  7. # Before the package is installed:
  8. #    <new-preinst> install
  9. #
  10. # Before removed package is upgraded:
  11. #    <new-preinst> install <old-version>
  12. #
  13. # Before the package is upgraded:
  14. #    <new-preinst> upgrade <old-version>
  15. #
  16. #
  17. # If postrm fails during upgrade or fails on failed upgrade:
  18. #    <old-preinst> abort-upgrade <new-version>
  19.  
  20.  
  21. # remove a no-longer used conffile
  22. rm_conffile()
  23. {
  24.     PKGNAME="$1"
  25.     CONFFILE="$2"
  26.  
  27.     if [ -e "$CONFFILE" ]; then
  28.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  29.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  30.         if [ "$md5sum" != "$old_md5sum" ]; then
  31.             echo "Obsolete conffile $CONFFILE has been modified by you."
  32.         echo "Saving as $CONFFILE.dpkg-bak ..."
  33.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  34.     else
  35.             echo "Removing obsolete conffile $CONFFILE ..." 
  36.         rm -f "$CONFFILE" 
  37.     fi
  38.     fi
  39. }
  40.  
  41.  
  42. case "$1" in
  43.     install|upgrade)
  44.     # Upgrade from previous versions
  45.     if dpkg --compare-versions "$2" lt "0.2.3-3"; then
  46.         rm_conffile consolekit /etc/init.d/consolekit
  47.         update-rc.d consolekit remove >/dev/null
  48.     fi
  49.     if dpkg --compare-versions "$2" lt-nl "0.2.10-1"; then
  50.          # Ubuntu versions prior to 8.04 LTS introduced this script as
  51.          # "90-console-kit", Debian/Ubuntu later settled for
  52.          # "90consolekit"; needs to be kept until April 2010 (Ubuntu 10.04
  53.          # LTS release)
  54.         rm_conffile consolekit /etc/X11/Xsession.d/90-console-kit
  55.     fi
  56.  
  57.     ;;
  58.  
  59.     abort-upgrade)
  60.     ;;
  61.  
  62.     *)
  63.     echo "$0 called with unknown argument \`$1'" 1>&2
  64.     exit 1
  65.     ;;
  66. esac
  67.  
  68.  
  69. exit 0
  70.