author | Markus Brökers <mbroeker@largo.homelinux.org> |
Thu, 26 Aug 2010 18:22:18 +0200 | |
changeset 56 | 99f85cd9b310 |
parent 35 | 3fedae1f6ceb |
permissions | -rw-r--r-- |
0 | 1 |
#!/bin/sh |
2 |
# postinst script for mcbot |
|
3 |
# |
|
4 |
# see: dh_installdeb(1) |
|
5 |
||
6 |
set -e |
|
7 |
||
8 |
# summary of how this script can be called: |
|
9 |
# * <postinst> `configure' <most-recently-configured-version> |
|
10 |
# * <old-postinst> `abort-upgrade' <new version> |
|
11 |
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
|
12 |
# <new-version> |
|
13 |
# * <postinst> `abort-remove' |
|
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 |
||
21 |
case "$1" in |
|
22 |
configure) |
|
31
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
23 |
if [ ! -f /var/lib/mcbot/data/mcbot.dat ]; |
32
89fb9c6611ca
unix system accounts are less than 1000
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
31
diff
changeset
|
24 |
then |
31
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
25 |
echo "Creating initial database in /var/lib/mcbot/data"; |
0 | 26 |
dbtool -a -k 1 -v 1; |
27 |
dbtool -d 1; |
|
28 |
fi |
|
29 |
||
31
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
30 |
if [ -f /var/lib/mcbot/.mcbotrc.dpkg-old ]; |
0 | 31 |
then |
31
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
32 |
mv -f /var/lib/mcbot/.mcbotrc.dpkg-old /var/lib/mcbot/.mcbotrc; |
0 | 33 |
fi |
34 |
||
31
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
35 |
echo "Changing ownership in /var/lib/mcbot" |
32
89fb9c6611ca
unix system accounts are less than 1000
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
31
diff
changeset
|
36 |
useradd -K UID_MIN=100 -K UID_MAX=999 -K GID_MIN=100 -K GID_MAX=999 -c "MCBOT" -s /bin/bash -d /var/lib/mcbot mcbot |
31
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
37 |
chown -R mcbot:mcbot /var/lib/mcbot |
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
38 |
echo "Setting permissions for /var/lib/mcbot/.mcbotrc to 600" |
bbcb8a3366b4
mcbot needs a proper system account
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
26
diff
changeset
|
39 |
chmod 600 /var/lib/mcbot/.mcbotrc |
5
7c7fc8906920
FreeBSD Stream Handling added and debian control files improved
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
40 |
echo "ENTER /etc/init.d/mcbot restart after editing .mcbotrc" |
35 | 41 |
update-rc.d mcbot defaults >/dev/null 2>&1 |
26
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
5
diff
changeset
|
42 |
invoke-rc.d mcbot restart |
0 | 43 |
;; |
44 |
||
45 |
abort-upgrade|abort-remove|abort-deconfigure) |
|
46 |
;; |
|
47 |
||
48 |
*) |
|
49 |
echo "postinst called with unknown argument \`$1'" >&2 |
|
50 |
exit 1 |
|
51 |
;; |
|
52 |
esac |
|
53 |
||
54 |
# dh_installdeb will replace this with shell code automatically |
|
55 |
# generated by other debhelper scripts. |
|
56 |
||
57 |
#DEBHELPER# |
|
58 |
||
59 |
exit 0 |