1 | #!/bin/sh -e |
---|
2 | |
---|
3 | . /usr/share/debconf/confmodule |
---|
4 | |
---|
5 | db_get bitlbee/serveport |
---|
6 | PORT="$RET" |
---|
7 | |
---|
8 | CONFDIR=/var/lib/bitlbee/ |
---|
9 | |
---|
10 | update-rc.d bitlbee defaults > /dev/null 2>&1 |
---|
11 | |
---|
12 | ## Load default option. Don't want to put this in debconf (yet?) |
---|
13 | BITLBEE_OPTS=-F |
---|
14 | BITLBEE_DISABLED=0 |
---|
15 | BITLBEE_UPGRADE_DONT_RESTART=0 |
---|
16 | [ -r /etc/default/bitlbee ] && source /etc/default/bitlbee |
---|
17 | |
---|
18 | if [ "$BITLBEE_DISABLED" = "0" ]; then |
---|
19 | ## In case it's still there (if we're upgrading right now) |
---|
20 | update-inetd --remove '.*/usr/sbin/bitlbee' |
---|
21 | fi |
---|
22 | |
---|
23 | cat<<EOF>/etc/default/bitlbee |
---|
24 | ## /etc/default/bitlbee: Auto-generated/updated script. |
---|
25 | ## |
---|
26 | ## Don't edit this line, use dpkg-reconfigure bitlbee |
---|
27 | BITLBEE_PORT="$PORT" |
---|
28 | |
---|
29 | ## Use single-process or forking daemon mode? Can't be changed from debconf, |
---|
30 | ## but maintainer scripts will save your changes here. |
---|
31 | BITLBEE_OPTS="$BITLBEE_OPTS" |
---|
32 | |
---|
33 | ## In case you want to stick with inetd mode (or if you just want to disable |
---|
34 | ## the init scripts for some other reason), you can disable the init script |
---|
35 | ## here. (Just set it to 1) |
---|
36 | BITLBEE_DISABLED=$BITLBEE_DISABLED |
---|
37 | |
---|
38 | ## As a server operator, you can use the RESTART command to restart only the |
---|
39 | ## master process while keeping all the child processes and their IPC |
---|
40 | ## connections. By enabling this, the maintainer scripts won't restart |
---|
41 | ## BitlBee during upgrades so you can restart the master process by hand. |
---|
42 | BITLBEE_UPGRADE_DONT_RESTART=$BITLBEE_UPGRADE_DONT_RESTART |
---|
43 | EOF |
---|
44 | |
---|
45 | ## Bye-bye DebConf, we don't need you anymore. |
---|
46 | db_stop |
---|
47 | |
---|
48 | if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then |
---|
49 | /etc/init.d/bitlbee restart |
---|
50 | fi |
---|
51 | |
---|
52 | ## If we're upgrading, we'll probably skip this next part |
---|
53 | if [ -d $CONFDIR ] && chown -R bitlbee $CONFDIR; then |
---|
54 | echo 'BitlBee (probably) already installed, skipping user/configdir installation' |
---|
55 | exit 0 |
---|
56 | fi |
---|
57 | |
---|
58 | adduser --system --home /var/lib/bitlbee/ --disabled-login --disabled-password bitlbee |
---|
59 | chmod 700 /var/lib/bitlbee/ |
---|
60 | |
---|
61 | ## Can't do this in packaging phase: Don't know the UID yet. Access to |
---|
62 | ## the file should be limited, now that it stores passwords. |
---|
63 | chmod 600 /etc/bitlbee/bitlbee.conf |
---|
64 | chown bitlbee /etc/bitlbee/bitlbee.conf |
---|
65 | |
---|
66 | if [ -z "$2" ]; then |
---|
67 | /etc/init.d/bitlbee start |
---|
68 | fi |
---|