File: postinst

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 (119 lines) | stat: -rw-r--r-- 2,665 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#! /bin/sh -e

CONFFILE=/etc/irda.conf
MODFILE=/etc/modutils/irda
INITSCR=/etc/init.d/irda

. /usr/share/debconf/confmodule

outputconf () {
    cat <<EOF > $MODFILE
alias tty-ldisc-11 irtty
alias char-major-161 ircomm-tty
alias char-major-60 ircomm_tty

# for dongle
alias irda-dongle-0 tekram
alias irda-dongle-1 esi
alias irda-dongle-2 actisys
alias irda-dongle-3 actisys
alias irda-dongle-4 girbil
alias irda-dongle-5 litelink
alias irda-dongle-6 airport
alias irda-dongle-7 old_belkin

# for FIR device
EOF
    
    echo "#irda.conf Version: 1.0" > $CONFFILE
    db_get irda-common/selectdevice
    if [ "$RET" = "serial" ]
    then
	db_get irda-common/ttydev
	echo "IRDADEV=$RET" >> $CONFFILE
	db_get irda-common/dongle
	if [ "$RET" = "none" ]
	then
	    echo "#DONGLE= # specify dongle type" >> $CONFFILE
	else
	    echo "DONGLE=$RET" >> $CONFFILE
	fi
	echo "#alias irda0 nsc-ircc dongle_id=0x09" >> $MODFILE
    else
	echo "IRDADEV=irda0" >> $CONFFILE
	echo "#DONGLE= # specify dongle type" >> $CONFFILE
	db_get irda-common/firdev
	FIRDEV=$RET
	db_get irda-common/firopt
	echo "alias irda0 $FIRDEV $RET" >> $MODFILE
    fi
    db_get irda-common/discovery
    if [ "$RET" = "true" ]
    then
	echo "DISCOVERY=-s" >> $CONFFILE
    else
	echo "#DISCOVERY=-s # if you want use discovery mode, uncomment this" >> $CONFFILE
    fi
    db_get irda-common/enable
    if [ "$RET" = "true" ]
    then
	echo 'ENABLE=yes # if you do not need to start irattach, set "no"' >> $CONFFILE
    else
	echo 'ENABLE=no # if you do not need to start irattach, set "no"' >> $CONFFILE
    fi

    /sbin/update-modules
}

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

    if [ ! -e /dev/.devfsd ]; then
	DEVTYPE=new
	if test -e /dev/ircommnew0 && test -e /dev/ircomm0
	then
	    set `ls -l /dev/ircomm0|tr -s ' '|tr -d ,|cut -f 5,6 -d ' '`
	    test $1 -eq 60 && DEVTYPE=old
	else
	    test -e /dev/ircomm0 || (cd /dev; /sbin/MAKEDEV irda)
	fi
	if [ "$DEVTYPE" = "old" ]
	then
	    db_input medium irda-common/mkirdev
	    db_go

	    rm /dev/ircomm0
	    (cd /dev && /sbin/MAKEDEV irda)

	    rm -f /dev/ircommold0-
	    mknod /dev/ircommold0- c 60 64
	    chgrp dialout /dev/ircommold0-
	    mv /dev/ircommold0- /dev/ircommold0
	fi
    fi

    if [ -f $CONFFILE ]
    then
	$INITSCR stop > /dev/null 2>&1
	db_get irda-common/regen
	if [ "$RET" = "true" ]
	then
	    outputconf
	fi
    else
	outputconf
    fi

    if [ -d /usr/doc -a ! -e /usr/doc/irda-common -a -d /usr/share/doc/irda-common ]; then
	ln -sf ../share/doc/irda-common /usr/doc/irda-common
    fi

    if [ -f /etc/init.d/irda ]
    then
	update-rc.d irda defaults >/dev/null
    fi

    $INITSCR start > /dev/null

fi

exit 0