Mercurial > notdcc
comparison debian/dcc-common.postinst @ 2:f6716cb00029
Replace buggy stuff in deb dir, never make phone calls while working
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Tue, 10 Mar 2009 14:29:12 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:9b8d79ac0dc3 | 2:f6716cb00029 |
---|---|
1 #!/bin/sh | |
2 # postinst script for dcc | |
3 # | |
4 # see: dh_installdeb(1) | |
5 | |
6 set -e | |
7 | |
8 | |
9 # summary of how this script can be called: | |
10 # * <postinst> `configure' <most-recently-configured-version> | |
11 # * <old-postinst> `abort-upgrade' <new version> | |
12 # * <conflictor's-postinst> `abort-remove' `in-favour' <package> | |
13 # <new-version> | |
14 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | |
15 # <failed-install-package> <version> `removing' | |
16 # <conflicting-package> <version> | |
17 # for details, see http://www.debian.org/doc/debian-policy/ or | |
18 # the debian-policy package | |
19 # | |
20 # quoting from the policy: | |
21 # Any necessary prompting should almost always be confined to the | |
22 # post-installation script, and should be protected with a conditional | |
23 # so that unnecessary prompting doesn't happen if a package's | |
24 # installation fails and the `postinst' is called with `abort-upgrade', | |
25 # `abort-remove' or `abort-deconfigure'. | |
26 #SCRIPTSCOMMON# | |
27 | |
28 | |
29 case "$1" in | |
30 configure) | |
31 # creating dcc group if he isn't already there | |
32 if ! getent group dcc >/dev/null; then | |
33 echo Adding system group: dcc. | |
34 addgroup --system dcc | |
35 fi | |
36 | |
37 # creating dcc user if he isn't already there | |
38 if ! getent passwd dcc >/dev/null; then | |
39 echo Adding system user: dcc. | |
40 adduser --system --ingroup dcc --no-create-home --home /var/lib/dcc dcc | |
41 usermod -c "DCC System User" dcc | |
42 # usermod -d "/var/lib/dcc" dcc | |
43 # usermod -g "dcc" dcc | |
44 usermod -s "/bin/false" dcc | |
45 fi | |
46 | |
47 | |
48 | |
49 | |
50 PASSWD1=`ps|cksum|tr ' ' 'xy'` | |
51 PASSWD2=`ps|cksum|tr ' ' 'xy'` | |
52 if ! [ -d /var/log/dcc ]; then | |
53 mkdir -p /var/log/dcc | |
54 ln -s /var/log/dcc /var/lib/dcc/log | |
55 fi | |
56 | |
57 if ! [ -f /etc/dcc/ids ]; then | |
58 sed -e "s/secret1/$PASSWD1/" -e "s/secret2/$PASSWD2/" /usr/share/dcc/ids > /etc/dcc/ids | |
59 chmod 0600 /etc/dcc/ids | |
60 chown dcc:dcc /etc/dcc/ids | |
61 fi | |
62 | |
63 if ! [ -f /etc/dcc/map.txt ]; then | |
64 sed -e "s/secret1/$PASSWD1/" /usr/share/dcc/map.txt > /etc/dcc/map.txt | |
65 /usr/sbin/update-dccmaps | |
66 chmod 0600 /etc/dcc/map.txt /var/lib/dcc/map | |
67 chown dcc:dcc /var/lib/dcc/map /etc/dcc/map.txt | |
68 fi | |
69 | |
70 if [ `stat -c%U /var/lib/dcc/map` != "dcc" ] || [ `stat -c%G /var/lib/dcc/map` != "dcc" ]; then | |
71 chown dcc:dcc /var/lib/dcc/map | |
72 fi | |
73 | |
74 if dpkg --compare-versions "$2" lt "1.2.58-1"; then | |
75 rm -f /var/lib/dcc/map | |
76 /usr/sbin/update-dccmaps | |
77 fi | |
78 | |
79 | |
80 if [ -x /usr/bin/cdcc ]; then | |
81 chown dcc:dcc /usr/bin/cdcc | |
82 chmod 04755 /usr/bin/cdcc | |
83 fi | |
84 | |
85 if [ -x /usr/bin/dccsight ]; then | |
86 chown dcc:dcc /usr/bin/dccsight | |
87 chmod 04755 /usr/bin/dccsight | |
88 fi | |
89 | |
90 if [ -d /var/lib/dcc ]; then | |
91 chown dcc:dcc /var/lib/dcc | |
92 fi | |
93 | |
94 if ! [ -d /var/run/dcc ]; then | |
95 mkdir -p /var/run/dcc | |
96 fi | |
97 | |
98 if [ -d /var/run/dcc ]; then | |
99 chown dcc:dcc /var/run/dcc | |
100 fi | |
101 ;; | |
102 | |
103 abort-upgrade|abort-remove|abort-deconfigure) | |
104 | |
105 ;; | |
106 | |
107 *) | |
108 echo "postinst called with unknown argument \`$1'" >&2 | |
109 exit 1 | |
110 ;; | |
111 esac | |
112 | |
113 # dh_installdeb will replace this with shell code automatically | |
114 # generated by other debhelper scripts. | |
115 | |
116 #DEBHELPER# | |
117 | |
118 exit 0 | |
119 | |
120 |