summaryrefslogtreecommitdiff
path: root/debian/bitlbee-common.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/bitlbee-common.postinst')
-rw-r--r--debian/bitlbee-common.postinst52
1 files changed, 52 insertions, 0 deletions
diff --git a/debian/bitlbee-common.postinst b/debian/bitlbee-common.postinst
new file mode 100644
index 0000000..93ef501
--- /dev/null
+++ b/debian/bitlbee-common.postinst
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -e
+
+CONFDIR=/var/lib/bitlbee/
+
+if [ -e /etc/default/bitlbee ]; then
+ cat <<EOF >/etc/default/bitlbee
+## /etc/default/bitlbee: Auto-generated/updated script.
+##
+## This file is deprecated and no longer used.
+## Please edit /etc/bitlbee/bitlbee.conf instead
+EOF
+
+fi
+
+## 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
+
+if [ -n "$2" -a -x "/etc/init.d/bitlbee" ]; then
+ invoke-rc.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'
+else
+ adduser --system --group --disabled-login --disabled-password --home /var/lib/bitlbee/ bitlbee
+fi
+
+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
+
+#DEBHELPER#