File: libslbreflex2.postinst

package info (click to toggle)
slbreflex 2.2.0-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 220 kB
  • ctags: 200
  • sloc: ansic: 1,523; sh: 81; makefile: 79
file content (73 lines) | stat: -rw-r--r-- 1,761 bytes parent folder | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
#
# postinst configure most-recently-configured-version 
# old-postinst abort-upgrade new-version 
# conflictor's-postinst abort-remove in-favour package new-version 
# deconfigured's-postinst abort-deconfigure in-favour failed-install-package version removing conflicting-package version 
#

set -e

cfgdir=/etc/reader.conf.d
cfg=$cfgdir/libslbreflex2
lib=/usr/lib/libslb_rf60.so.2.0.0

if [ "$1" = "configure" ]; then

  # Source debconf library.
  . /usr/share/debconf/confmodule

  db_get 'libslbreflex2/port' || true
  SERIAL_PORT="$RET"

  # First make sure the cfgdir exists
  if [ ! -d $cfgdir ]; then
    mkdir -p $cfgdir
  fi

  echo "FRIENDLYNAME      \"Schlumberger Reflex 62/64 reader\"" > $cfg
  echo "DEVICENAME        SLB_REFLEX_62_64" >> $cfg
  echo "LIBPATH           $lib" >> $cfg

  case "$SERIAL_PORT" in
    ttyS0)
      echo "CHANNELID         0x0103F8" >> $cfg
      ;;
    ttyS1)
      echo "CHANNELID         0x0102F8" >> $cfg
      ;;
    ttyS2)
      echo "CHANNELID         0x0103E8" >> $cfg
      ;;
    ttyS3)
      echo "CHANNELID         0x0102E8" >> $cfg
      ;;
    *)
      echo "Error: serial port unknown ($SERIAL_PORT)"
      ;;
  esac

  # regenerate /etc/reader.conf if update-reader.conf is available
  if [ -x /usr/sbin/update-reader.conf ]; then
    /usr/sbin/update-reader.conf || true
  fi

  # restart pcscd (PCSC daemon) if the package is installed
  # and if pcscd is running
  if [ -x /etc/init.d/pcscd ]; then
    if test -f /var/run/pcscd.pid; then 
      if test -d /proc/`cat /var/run/pcscd.pid`; then 
	if which invoke-rc.d >/dev/null 2>&1; then
     		invoke-rc.d pcscd restart
     	else
        	/etc/init.d/pcscd restart 3>/dev/null
     	fi
      fi
    fi
  fi

  db_stop

fi

#DEBHELPER#