source: debian/postinst @ 2c2df7d

Last change on this file since 2c2df7d was 7448e1b, checked in by Wilmer van der Gaast <wilmer@…>, at 2007-10-22T22:39:46Z

debian/ specific: Changed "rm help.txt at upgrade" hack to not remove the
file but rename it and rename it back in postinst in case we were doing
a dpkg-reconfigure instead of an upgrade.

  • Property mode set to 100755
File size: 2.4 KB
Line 
1#!/bin/sh -e
2
3. /usr/share/debconf/confmodule
4
5db_get bitlbee/serveport
6PORT="$RET"
7
8CONFDIR=/var/lib/bitlbee/
9
10update-rc.d bitlbee defaults > /dev/null 2>&1
11
12## Load default option. Don't want to put this in debconf (yet?)
13BITLBEE_OPTS=-F
14BITLBEE_DISABLED=0
15BITLBEE_UPGRADE_DONT_RESTART=0
16[ -r /etc/default/bitlbee ] && source /etc/default/bitlbee
17
18if [ "$BITLBEE_DISABLED" = "0" ]; then
19        ## In case it's still there (if we're upgrading right now)
20        update-inetd --remove '.*/usr/sbin/bitlbee'
21fi
22
23cat<<EOF>/etc/default/bitlbee
24## /etc/default/bitlbee: Auto-generated/updated script.
25##
26## Don't edit this line, use dpkg-reconfigure bitlbee
27BITLBEE_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.
31BITLBEE_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)
36BITLBEE_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.
42BITLBEE_UPGRADE_DONT_RESTART=$BITLBEE_UPGRADE_DONT_RESTART
43EOF
44
45## Bye-bye DebConf, we don't need you anymore.
46db_stop
47
48## Restore the helpfile in case we weren't upgrading but just reconfiguring:
49if [ -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
55fi
56
57if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then
58        /etc/init.d/bitlbee restart
59fi
60
61## If we're upgrading, we'll probably skip this next part
62if [ -d $CONFDIR ] && chown -R bitlbee $CONFDIR; then
63        echo 'BitlBee (probably) already installed, skipping user/configdir installation'
64        exit 0
65fi
66
67adduser --system --home /var/lib/bitlbee/ --disabled-login --disabled-password bitlbee
68chmod 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.
72chmod 600 /etc/bitlbee/bitlbee.conf
73chown bitlbee /etc/bitlbee/bitlbee.conf
74
75if [ -z "$2" ]; then
76        /etc/init.d/bitlbee start
77fi
Note: See TracBrowser for help on using the repository browser.