home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / ucf / examples / postrm < prev   
Encoding:
Text File  |  2006-04-11  |  3.4 KB  |  116 lines

  1. #! /bin/sh
  2. # postrm.skeleton
  3. # Skeleton maintainer script showing all the possible cases.
  4. # Written by Charles Briscoe-Smith, March-June 1998.  Public Domain.
  5.  
  6. # Abort if any command returns an error value
  7. set -e
  8.  
  9. # This script is called twice during the removal of the package; once
  10. # after the removal of the package's files from the system, and as
  11. # the final step in the removal of this package, after the package's
  12. # conffiles have been removed.
  13.  
  14. # Ensure the menu system is updated
  15. : [ ! -x /usr/bin/update-menus ] || /usr/bin/update-menus
  16.  
  17. case "$1" in
  18.   remove)
  19.     # This package is being removed, but its configuration has not yet
  20.     # been purged.
  21.     :
  22.  
  23.     # Remove diversion
  24.     : dpkg-divert --package foo --remove --rename \
  25.     :             --divert /usr/bin/other.real /usr/bin/other
  26.  
  27.     # ldconfig is NOT needed during removal of a library, only during
  28.     # installation
  29.  
  30.     ;;
  31.   purge)
  32.     # This package has previously been removed and is now having
  33.     # its configuration purged from the system.
  34.     :
  35.  
  36.     # we mimic dpkg as closely as possible, so we remove configuration
  37.     # files with dpkg backup extensions too:
  38.     ### Some of the following is from Tore Anderson:
  39.     for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist;  do
  40.     rm -f /etc/foo.conf$ext
  41.     done
  42.  
  43.     # remove the configuration file itself
  44.     rm -f /etc/foo.conf
  45.  
  46.     # and finally clear it out from the ucf database
  47.     if which ucf >/dev/null; then
  48.         ucf --purge /etc/foo.conf
  49.     fi    
  50.     if which ucfr >/dev/null; then
  51.         ucfr --purge foo /etc/foo.conf
  52.     fi    
  53.  
  54.     # Remove symlinks from /etc/rc?.d
  55.     : update-rc.d foo remove >/dev/null
  56.  
  57.     ;;
  58.   disappear)
  59.     if test "$2" != overwriter; then
  60.       echo "$0: undocumented call to \`postrm $*'" 1>&2
  61.       exit 0
  62.     fi
  63.     # This package has been completely overwritten by package $3
  64.     # (version $4).  All our files are already gone from the system.
  65.     # This is a special case: neither "prerm remove" nor "postrm remove"
  66.     # have been called, because dpkg didn't know that this package would
  67.     # disappear until this stage.
  68.     :
  69.  
  70.     ;;
  71.   upgrade)
  72.     # About to upgrade FROM THIS VERSION to version $2 of this package.
  73.     # "prerm upgrade" has been called for this version, and "preinst
  74.     # upgrade" has been called for the new version.  Last chance to
  75.     # clean up.
  76.     :
  77.  
  78.     ;;
  79.   failed-upgrade)
  80.     # About to upgrade from version $2 of this package TO THIS VERSION.
  81.     # "prerm upgrade" has been called for the old version, and "preinst
  82.     # upgrade" has been called for this version.  This is only used if
  83.     # the previous version's "postrm upgrade" couldn't handle it and
  84.     # returned non-zero. (Fix old postrm bugs here.)
  85.     :
  86.  
  87.     ;;
  88.   abort-install)
  89.     # Back out of an attempt to install this package.  Undo the effects of
  90.     # "preinst install...".  There are two sub-cases.
  91.     :
  92.  
  93.     if test "${2+set}" = set; then
  94.       # When the install was attempted, version $2's configuration
  95.       # files were still on the system.  Undo the effects of "preinst
  96.       # install $2".
  97.       :
  98.  
  99.     else
  100.       # We were being installed from scratch.  Undo the effects of
  101.       # "preinst install".
  102.       :
  103.  
  104.     fi ;;
  105.   abort-upgrade)
  106.     # Back out of an attempt to upgrade this package from version $2
  107.     # TO THIS VERSION.  Undo the effects of "preinst upgrade $2".
  108.     :
  109.  
  110.     ;;
  111.   *) echo "$0: didn't understand being called with \`$1'" 1>&2
  112.      exit 0;;
  113. esac
  114.  
  115. exit 0
  116.