File: preinst

package info (click to toggle)
irda-utils 0.9.14-17
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,336 kB
  • ctags: 1,193
  • sloc: sh: 7,308; ansic: 5,547; makefile: 235; perl: 224
file content (53 lines) | stat: -rw-r--r-- 1,106 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
#!/bin/sh -e

INITSCR=/etc/init.d/irda
CONFFILE=/etc/irda.conf
MODUTILS=/etc/modutils/irda
PIDDIR=/var/run

. /usr/share/debconf/confmodule

if [ "$1" = "upgrade" ]
then
    if test -e $PIDDIR/irmanager.pid || test -e $PIDDIR/irattach.pid
    then
	$INITSCR stop > /dev/null 2>&1
    fi

    if [ ! -e $CONFFILE ]
    then
	ENABLE=false
	egrep '^exit 0; # edit DEVICE' $INITSCR > /dev/null && ENABLE=true
	db_set irda-common/enable $ENABLE
	eval `egrep '^DEVICE' $INITSCR`
	case "$DEVICE" in
	    /dev/ttyS*)
		db_set irda-common/selectdevice serial
		db_set irda-common/ttydev $DEVICE
		;;
	    irda0)
		db_set irda-common/selectdevice native
		if [ -f $MODUTILS ]
		then
		    set `egrep "^alias irda0" $MODUTILS`
		    db_set irda-common/firdev $3
		    shift; shift; shift
		    db_set irda-common/firopt "$*"
		fi
		;;
	esac
	eval `egrep '^DISCOVERY' $INITSCR`
	if [ "$DISCOVERY" = "" ]
	then
	    db_set irda-common/discovery false
	fi
    fi

    # for old init script
    if [ -f /etc/init.d/irmanager ]
    then
	update-rc.d -f irmanager remove  >/dev/null
	rm -f /etc/init.d/irmanager
    fi
fi