File: thinkpad-base.postinst

package info (click to toggle)
thinkpad 5.8-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 604 kB
  • ctags: 1,459
  • sloc: ansic: 5,985; makefile: 226; sh: 179; asm: 44; sed: 22
file content (60 lines) | stat: -rw-r--r-- 1,163 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
#!/bin/sh
set -e

devfs_is_active()
{
	test -e /dev/.devfsd
}

kernel_is_2_6_or_above()
{
	case "$(uname -r)" in
		1.*|2.[012345]*) return 1 ;;
		*) return 0 ;;
	esac
}

udev_is_active()
{
	test -e /dev/.udev.tdb || test -d /dev/.udevdb || return 1
	kernel_is_2_6_or_above || return 1
	return 0
}

case "${1}" in
configure|reconfigure)
	addgroup --system thinkpad >/dev/null || true
	if devfs_is_active; then
		# devfs enabled
		update-devfsd > /dev/null 2>&1 || true
	elif udev_is_active; then
		# udev enabled
		: # Do nothing
	else
		# Neither devfs nor udev enabled
		cd /dev
		[ -c thinkpad ] && rm -f thinkpad
		[ -c smapi ] && rm -f smapi
		MAKEOUT="$(/sbin/MAKEDEV -v thinkpad)"
		echo "$MAKEOUT" | {
			read ACTION NODE REST
			if [ "$ACTION" = "create" ] && [ -c "$NODE" ] ; then
				if chown root:thinkpad "/dev/$NODE" ; then
					echo "Created device node /dev/$NODE owned by root:thinkpad"
				else
					echo "Created device node /dev/$NODE but could not change its owner"
				fi
			fi
		}
	fi
	;;
# abort-upgrade|abort-remove|abort-deconfigure)
	# Do nothing
*)
	echo "postinst called with unknown argument \`$1'" >&2
	exit 1
	;;
esac

#DEBHELPER#