postinst is in bitlbee-common 3.2.1+otr4-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | #!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_get bitlbee/serveport
PORT="$RET"
CONFDIR=/var/lib/bitlbee/
update-rc.d bitlbee defaults > /dev/null 2>&1
## Load default option. Don't want to put this in debconf (yet?)
BITLBEE_OPTS=-F
BITLBEE_DISABLED=0
BITLBEE_UPGRADE_DONT_RESTART=0
[ -r /etc/default/bitlbee ] && . /etc/default/bitlbee
if [ "$BITLBEE_DISABLED" = "0" ] && which update-inetd > /dev/null 2> /dev/null &&
( expr "$2" : '0\..*' > /dev/null || expr "$2" : '1\.0\..*' > /dev/null ); then
## Make sure the inetd entry is gone (can still be there from a
## previous version.
update-inetd --remove '.*/usr/sbin/bitlbee'
if grep -q /usr/sbin/bitlbee /etc/inetd.conf 2> /dev/null; then
# Thanks for breaking update-inetd! (bugs.debian.org/311111)
# I hope that it works at least with xinetd, because this
# emergency hack doesn't:
perl -pi -e 's:^[^#].*/usr/sbin/bitlbee$:## Now using daemon mode\: # $&:' /etc/inetd.conf
killall -HUP inetd || true
fi
fi
cat<<EOF>/etc/default/bitlbee
## /etc/default/bitlbee: Auto-generated/updated script.
##
## If running in (fork)daemon mode, listen on this TCP port.
BITLBEE_PORT="$PORT"
## Use single-process or forking daemon mode? Can't be changed from debconf,
## but maintainer scripts will save your changes here.
BITLBEE_OPTS="$BITLBEE_OPTS"
## In case you want to stick with inetd mode (or if you just want to disable
## the init scripts for some other reason), you can disable the init script
## here. (Just set it to 1)
BITLBEE_DISABLED=$BITLBEE_DISABLED
## As a server operator, you can use the RESTART command to restart only the
## master process while keeping all the child processes and their IPC
## connections. By enabling this, the maintainer scripts won't restart
## BitlBee during upgrades so you can restart the master process by hand.
BITLBEE_UPGRADE_DONT_RESTART=$BITLBEE_UPGRADE_DONT_RESTART
EOF
## Bye-bye DebConf, we don't need you anymore.
db_stop
## Restore the helpfile in case we weren't upgrading but just reconfiguring:
if [ -e /usr/share/bitlbee/help.upgrading ]; then
if [ -e /usr/share/bitlbee/help.txt ]; then
rm -f /usr/share/bitlbee/help.upgrading
else
mv /usr/share/bitlbee/help.upgrading /usr/share/bitlbee/help.txt
fi
fi
# The official way to check if we're upgrading is to check if $2 is
# non-empty. However, previous versions of BitlBee didn't have a
# bitlbee-common package so in that case the var will also be empty.
# Instead, check if the port is in use (if netstat is available). This
# works since the debconf code will pick a free port on new installs.
if [ "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then
unset IS_UPGRADE
if which netstat > /dev/null 2> /dev/null; then
netstat -an | grep -q :$PORT\\b.*LISTEN && IS_UPGRADE=1
else
[ -n "$2" ] && IS_UPGRADE=1
fi
if [ -n "$IS_UPGRADE" ]; then
invoke-rc.d bitlbee restart
fi
fi
## If we're upgrading, we'll probably skip this next part
if [ -d $CONFDIR ] && chown -R bitlbee: $CONFDIR; then
echo 'BitlBee (probably) already installed, skipping user/configdir installation'
exit 0
fi
adduser --system --group --disabled-login --disabled-password --home /var/lib/bitlbee/ bitlbee
chmod 700 /var/lib/bitlbee/
## Can't do this in packaging phase: Don't know the UID yet. Access to
## the file should be limited, now that it stores passwords. Added
## --group later for a little more security, but have to see if I can
## apply this change to existing installations on upgrades. Will think
## about that later.
if getent group bitlbee > /dev/null; then
chmod 640 /etc/bitlbee/bitlbee.conf
chown root:bitlbee /etc/bitlbee/bitlbee.conf
else
chmod 600 /etc/bitlbee/bitlbee.conf
chown bitlbee /etc/bitlbee/bitlbee.conf
fi
if [ -z "$2" ]; then
invoke-rc.d bitlbee start
fi
|