aboutsummaryrefslogtreecommitdiffstats
path: root/debian/bitlbee-common.postinst
blob: 93ef5010b1a788c21cca986e5035270267c32af0 (plain)
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
#!/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#