source: debian/postinst @ 0cab388

Last change on this file since 0cab388 was 628e601, checked in by Wilmer van der Gaast <wilmer@…>, at 2008-03-24T19:48:36Z

Some more changes for 1.2-2: Adding a bitlbee group for extra security
and small stuff.

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