diff options
Diffstat (limited to 'debian/postinst')
-rwxr-xr-x | debian/postinst | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 00000000..6c99c40d --- /dev/null +++ b/debian/postinst @@ -0,0 +1,68 @@ +#!/bin/sh -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 ] && source /etc/default/bitlbee + +if [ "$BITLBEE_DISABLED" = "0" ]; then + ## In case it's still there (if we're upgrading right now) + update-inetd --remove '.*/usr/sbin/bitlbee' +fi + +cat<<EOF>/etc/default/bitlbee +## /etc/default/bitlbee: Auto-generated/updated script. +## +## Don't edit this line, use dpkg-reconfigure bitlbee +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 + +if [ -n "$2" -a "$BITLBEE_UPGRADE_DONT_RESTART" != "1" ]; then + /etc/init.d/bitlbee restart +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 --home /var/lib/bitlbee/ --disabled-login --disabled-password 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. +chmod 600 /etc/bitlbee/bitlbee.conf +chown bitlbee /etc/bitlbee/bitlbee.conf + +if [ -z "$2" ]; then + /etc/init.d/bitlbee start +fi |