File: scanbd.postinst

package info (click to toggle)
scanbd 1.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,156 kB
  • ctags: 943
  • sloc: sh: 11,721; ansic: 7,637; makefile: 249
file content (51 lines) | stat: -rw-r--r-- 1,561 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# postinst script for scanbd

set -e

TEMPFILE=$(mktemp)
cat >$TEMPFILE <<EOF
# Upon first installation, this file is filled with all supported SANE backends available at that time.
# This is done to avoid having to ask the user to choose a backend.  If you know what backend you want
# to use you can improve performance by deleting or commenting out all other backends here.

EOF

case "$1" in
    configure)
	# link all supported SANE backends into the scanbd config directory
	cd /etc
	for file in sane.d/*.conf; do
	  backend=$(basename -s .conf $file)
	  case $backend in
	    dll|dc210|dc240|dc25|dmc|gphoto2|net|saned|test|v4l)
	      # do nothing in particular, this config file does not represent a scanbd-supported backend
	      [ -L scanbd/$backend.conf ] && logger "$backend is not a scanbd-supported backend. You should consider removing the link /etc/scanbd/$backend.conf."
	    ;;
	    *)
	      # create a link to the saned backend, unless the link or file already exists (possibly with customized content)
	      [ -e scanbd/$backend.conf ] || ln -s ../$file scanbd/
	      # keep tabs on what backends are available
	      echo $backend >> $TEMPFILE
	    ;;
	  esac
	done
	mv -n $TEMPFILE /etc/scanbd/dll.conf
	cd - > /dev/null
	update-inetd --add 'sane-port stream tcp nowait saned /usr/sbin/scanbm scanbm'
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
	exit 1
    ;;
esac
chmod +r /etc/scanbd/dll.conf
rm -f $TEMPFILE

#DEBHELPER#

exit 0