File: vlock.postinst

package info (click to toggle)
vlock 2.2.2-3
  • links: PTS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 452 kB
  • ctags: 342
  • sloc: ansic: 2,955; sh: 877; makefile: 232
file content (59 lines) | stat: -rw-r--r-- 1,339 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
#!/bin/sh -e

# inspired by the tor postinst script
# checking vlock group

gid=`getent group vlock | cut -d ":" -f 3`

# if there is the uid the account is there and we can do
# the sanit(ar)y checks otherwise we can safely create it.

if [ -z "$gid" ]; then
    # what this might mean?? oh creating a system l^Huser!
    addgroup --quiet \
            --system \
	    vlock 
fi

#They are not available anymore, so they can be safely removed if they exist. 

for i in /usr/sbin/vlock-nosysrq /usr/sbin/vlock-new /usr/sbin/vlock-current
do
	# only do something when no setting exists
	if dpkg-statoverride --list $i >/dev/null 2>&1
	then
		dpkg-statoverride --remove $i 
	fi
done

if ! dpkg-statoverride --list /usr/sbin/vlock-main >/dev/null 2>&1
then
	dpkg-statoverride --update --add root root 4711 /usr/sbin/vlock-main 
fi

#unprivileged modules

for i in /usr/lib/vlock/modules/all.so 
do
	# only do something when no setting exists
	if ! dpkg-statoverride --list $i >/dev/null 2>&1
	then
		dpkg-statoverride --update --add root root 755 $i 
	fi
done

#privileged modules

for i in /usr/lib/vlock/modules/new.so /usr/lib/vlock/modules/nosysrq.so
do
	# only do something when no setting exists
	if ! dpkg-statoverride --list $i >/dev/null 2>&1
	then
		dpkg-statoverride --update --add root vlock 750 $i
	fi
done


#DEBHELPER#

exit 0