source: debian/postinst @ 379c08a

1.2-1
Last change on this file since 379c08a was 379c08a, checked in by Wilmer van der Gaast <wilmer@…>, at 2008-03-21T00:27:24Z

Updated/Fixed Debian package.

  • Property mode set to 100755
File size: 2.8 KB
RevLine 
[19a8088]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
[379c08a]18if [ "$BITLBEE_DISABLED" = "0" ] && expr "$2" : '0\..*' > /dev/null || expr "$2" : '1\.0\..*' > /dev/null; then
[19a8088]19        ## In case it's still there (if we're upgrading right now)
20        update-inetd --remove '.*/usr/sbin/bitlbee'
[379c08a]21        if grep -q /usr/sbin/bitlbee /etc/inetd.conf 2> /dev/null; then
22                # Thanks for breaking update-inetd! (bugs.debian.org/311111)
23                # I hope that it works at least with xinetd, because this
24                # emergency hack doesn't:
25                perl -pi -e 's:^[^#].*/usr/sbin/bitlbee$:## Now using daemon mode\: # $&:' /etc/inetd.conf
26                killall -HUP inetd
27        fi
[19a8088]28fi
29
30cat<<EOF>/etc/default/bitlbee
31## /etc/default/bitlbee: Auto-generated/updated script.
32##
33## Don't edit this line, use dpkg-reconfigure bitlbee
34BITLBEE_PORT="$PORT"
35
36## Use single-process or forking daemon mode? Can't be changed from debconf,
37## but maintainer scripts will save your changes here.
38BITLBEE_OPTS="$BITLBEE_OPTS"
39
40## In case you want to stick with inetd mode (or if you just want to disable
41## the init scripts for some other reason), you can disable the init script
42## here. (Just set it to 1)
43BITLBEE_DISABLED=$BITLBEE_DISABLED
44
45## As a server operator, you can use the RESTART command to restart only the
46## master process while keeping all the child processes and their IPC
47## connections. By enabling this, the maintainer scripts won't restart
48## BitlBee during upgrades so you can restart the master process by hand.
49BITLBEE_UPGRADE_DONT_RESTART=$BITLBEE_UPGRADE_DONT_RESTART
50EOF
51
52## Bye-bye DebConf, we don't need you anymore.
53db_stop
54
[7448e1b]55## Restore the helpfile in case we weren't upgrading but just reconfiguring:
56if [ -e /usr/share/bitlbee/help.upgrading ]; then
57        if [ -e /usr/share/bitlbee/help.txt ]; then
58                rm -f /usr/share/bitlbee/help.upgrading
59        else
60                mv /usr/share/bitlbee/help.upgrading /usr/share/bitlbee/help.txt
61        fi
62fi
63
[19a8088]64if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then
65        /etc/init.d/bitlbee restart
66fi
67
68## If we're upgrading, we'll probably skip this next part
69if [ -d $CONFDIR ] && chown -R bitlbee $CONFDIR; then
70        echo 'BitlBee (probably) already installed, skipping user/configdir installation'
71        exit 0
72fi
73
74adduser --system --home /var/lib/bitlbee/ --disabled-login --disabled-password bitlbee
75chmod 700 /var/lib/bitlbee/
76
77## Can't do this in packaging phase: Don't know the UID yet. Access to
78## the file should be limited, now that it stores passwords.
79chmod 600 /etc/bitlbee/bitlbee.conf
80chown bitlbee /etc/bitlbee/bitlbee.conf
81
82if [ -z "$2" ]; then
83        /etc/init.d/bitlbee start
84fi
Note: See TracBrowser for help on using the repository browser.