File: postinst.module

package info (click to toggle)
tun 1.1-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 496 kB
  • ctags: 329
  • sloc: ansic: 2,936; sh: 1,584; makefile: 341
file content (62 lines) | stat: -rw-r--r-- 1,132 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
#! /bin/sh
# postinst script for tun
# tasks: setup device file, modutils-file, modules dependencies

# unfortunately these are not officially known, 
# thus MAKEDEV is not useable :-(
	TUN_MAJOR=90
	TUN_MINOR=0
	TAP_MINOR=128
# how many devices of each type do we want?
# a good guestimate
	HOWMANY=4;

PKGNAME="tun-module-${kpkg:Kernel-Version}";

set -e

case "$1" in
    configure)
	depmod -a || true;

	if [ -x /sbin/update-modules ]; 
	then
	    /sbin/update-modules
	fi

	if [ ! -c /dev/.devfsd ];
	then
	    for i in `seq 0 $HOWMANY`;
	    do
	      if [ ! -c /dev/tun$i ];
	      then
		  echo "Generating device file /dev/tun$i";
		  rm -f /dev/tun$i;
		  j=$(($i+$TUN_MINOR));
		  mknod -m 0600 /dev/tun$i c $TUN_MAJOR $j
	      fi
	      if [ ! -c /dev/tap$i ];
	      then
		  echo "Generating device file /dev/tap$i";
		  rm -f /dev/tap$i;
		  j=$(($i+$TAP_MINOR));
		  mknod -m 0600 /dev/tap$i c $TUN_MAJOR $j
	      fi
	    done
	fi
    ;;

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

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac


exit 0