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 | ## Restore the helpfile in case we weren't upgrading but just reconfiguring: |
---|
49 | if [ -e /usr/share/bitlbee/help.upgrading ]; then |
---|
50 | if [ -e /usr/share/bitlbee/help.txt ]; then |
---|
51 | rm -f /usr/share/bitlbee/help.upgrading |
---|
52 | else |
---|
53 | mv /usr/share/bitlbee/help.upgrading /usr/share/bitlbee/help.txt |
---|
54 | fi |
---|
55 | fi |
---|
56 | |
---|
57 | if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then |
---|
58 | /etc/init.d/bitlbee restart |
---|
59 | fi |
---|
60 | |
---|
61 | ## If we're upgrading, we'll probably skip this next part |
---|
62 | if [ -d $CONFDIR ] && chown -R bitlbee $CONFDIR; then |
---|
63 | echo 'BitlBee (probably) already installed, skipping user/configdir installation' |
---|
64 | exit 0 |
---|
65 | fi |
---|
66 | |
---|
67 | adduser --system --home /var/lib/bitlbee/ --disabled-login --disabled-password bitlbee |
---|
68 | chmod 700 /var/lib/bitlbee/ |
---|
69 | |
---|
70 | ## Can't do this in packaging phase: Don't know the UID yet. Access to |
---|
71 | ## the file should be limited, now that it stores passwords. |
---|
72 | chmod 600 /etc/bitlbee/bitlbee.conf |
---|
73 | chown bitlbee /etc/bitlbee/bitlbee.conf |
---|
74 | |
---|
75 | if [ -z "$2" ]; then |
---|
76 | /etc/init.d/bitlbee start |
---|
77 | fi |
---|