home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh -e
-
- purge_devfs() {
- if [ -f "/etc/devfs/conf.d/scanner" ] ; then
- rm -f /etc/devfs/conf.d/scanner
- rmdir --parents --ignore-fail-on-non-empty /etc/devfs/
- fi
- }
-
- purge_hotplugng() {
- if [ -f "/etc/hotplug.d/usb/libsane.hotplug" ]; then
- rm -f /etc/hotplug.d/usb/libsane.hotplug
- rmdir --parents --ignore-fail-on-non-empty /etc/hotplug.d/usb
- fi
-
- if [ -f "/etc/hotplug/blacklist.d/libsane" ]; then
- rm -f /etc/hotplug/blacklist.d/libsane
- rmdir --parents --ignore-fail-on-non-empty /etc/hotplug/blacklist.d
- fi
-
- if [ -f "/etc/sane.d/hotplug/libsane.db" ]; then
- rm -f /etc/sane.d/hotplug/libsane.db
- rmdir --parents --ignore-fail-on-non-empty /etc/sane.d/hotplug
- fi
-
- rm -f /etc/modprobe.d/libsane
- rm -f /etc/udev/rules.d/libsane.rules
- }
-
- purge_hotplug() {
- if [ -f "/etc/hotplug/usb/libsane.usermap" ] ; then
- rm -f /etc/hotplug/usb/libsane.usermap
- fi
- if [ -f "/etc/hotplug/usb/libusbscanner" ] ; then
- rm -f /etc/hotplug/usb/libusbscanner
- fi
- if [ -d "/etc/hotplug/usb" ]; then
- rmdir --parents --ignore-fail-on-non-empty /etc/hotplug/usb
- fi
- }
-
- case "$1" in
- configure)
- # Add the scanner system group if it doesn't exist
- if ! getent group | grep -q "^scanner:"; then
- echo "Adding scanner group..."
- addgroup --quiet --system scanner || true
- fi
-
- if [ "$(uname -s)" = "Linux" ]; then
- # remove devfs config as scanning through usbscanner is not supported anymore
- purge_devfs
- # remove old hotplug scripts
- purge_hotplug
-
- purge_hotplugng
-
- if [ ! -c /dev/.devfsd ]; then
- # create /dev/parport*
- if [ ! -c /dev/parport0 ]; then
- (cd /dev && /sbin/MAKEDEV parport) || true
- fi
- # create /dev/sg*
- if [ ! -c /dev/sg0 ]; then
- (cd /dev && /sbin/MAKEDEV sg) || true
- fi
- fi
- fi
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
-
- *)
- echo "$0 called with unknown argument '$1'" >&2
- exit 1
- ;;
- esac
-
-
- # Automatically added by dh_makeshlibs
- if [ "$1" = "configure" ]; then
- ldconfig
- fi
- # End automatically added section
-
-