home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / var / lib / dpkg / info / libsane.postinst < prev    next >
Encoding:
Text File  |  2006-07-10  |  2.0 KB  |  87 lines

  1. #!/bin/sh -e
  2.  
  3. purge_devfs() {
  4.     if [ -f "/etc/devfs/conf.d/scanner" ] ; then
  5.     rm -f /etc/devfs/conf.d/scanner
  6.     rmdir --parents --ignore-fail-on-non-empty /etc/devfs/
  7.     fi
  8. }
  9.  
  10. purge_hotplugng() {
  11.     if [ -f "/etc/hotplug.d/usb/libsane.hotplug" ]; then
  12.     rm -f /etc/hotplug.d/usb/libsane.hotplug
  13.     rmdir --parents --ignore-fail-on-non-empty /etc/hotplug.d/usb
  14.     fi
  15.  
  16.     if [ -f "/etc/hotplug/blacklist.d/libsane" ]; then
  17.     rm -f /etc/hotplug/blacklist.d/libsane
  18.     rmdir --parents --ignore-fail-on-non-empty /etc/hotplug/blacklist.d
  19.     fi
  20.  
  21.     if [ -f "/etc/sane.d/hotplug/libsane.db" ]; then
  22.     rm -f /etc/sane.d/hotplug/libsane.db
  23.     rmdir --parents --ignore-fail-on-non-empty /etc/sane.d/hotplug
  24.     fi
  25.  
  26.     rm -f /etc/modprobe.d/libsane
  27.     rm -f /etc/udev/rules.d/libsane.rules
  28. }
  29.  
  30. purge_hotplug() {
  31.     if [ -f "/etc/hotplug/usb/libsane.usermap" ] ; then
  32.     rm -f /etc/hotplug/usb/libsane.usermap
  33.     fi
  34.     if [ -f "/etc/hotplug/usb/libusbscanner" ] ; then
  35.     rm -f /etc/hotplug/usb/libusbscanner
  36.     fi
  37.     if [ -d "/etc/hotplug/usb" ]; then
  38.     rmdir --parents --ignore-fail-on-non-empty /etc/hotplug/usb
  39.     fi
  40. }
  41.  
  42. case "$1" in
  43.     configure)
  44.     # Add the scanner system group if it doesn't exist
  45.     if ! getent group | grep -q "^scanner:"; then
  46.     echo "Adding scanner group..."
  47.     addgroup --quiet --system scanner || true
  48.     fi
  49.  
  50.     if [ "$(uname -s)" = "Linux" ]; then
  51.     # remove devfs config as scanning through usbscanner is not supported anymore
  52.     purge_devfs
  53.     # remove old hotplug scripts
  54.     purge_hotplug
  55.  
  56.     purge_hotplugng
  57.  
  58.     if [ ! -c /dev/.devfsd ]; then
  59.         # create /dev/parport*
  60.         if [ ! -c /dev/parport0 ]; then
  61.         (cd /dev && /sbin/MAKEDEV parport) || true 
  62.         fi
  63.         # create /dev/sg*
  64.         if [ ! -c /dev/sg0 ]; then
  65.         (cd /dev && /sbin/MAKEDEV sg) || true 
  66.         fi
  67.     fi
  68.     fi
  69.     ;;
  70.  
  71.     abort-upgrade|abort-remove|abort-deconfigure)
  72.     ;;
  73.  
  74.     *)
  75.     echo "$0 called with unknown argument '$1'" >&2
  76.     exit 1
  77.     ;;
  78. esac
  79.  
  80.  
  81. # Automatically added by dh_makeshlibs
  82. if [ "$1" = "configure" ]; then
  83.     ldconfig
  84. fi
  85. # End automatically added section
  86.  
  87.