1#!/bin/sh
2# postinst script for bareos
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see http://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20daemon_user=bareos
21daemon_group=bareos
22
23#director_daemon_user=$daemon_user
24storage_daemon_user=$daemon_user
25#file_daemon_user=root
26storage_daemon_group=$daemon_group
27
28
29
30permissions()
31{
32  chown ${storage_daemon_user}:${daemon_group} /var/lib/bareos/storage/
33  chmod 750 /var/lib/bareos/storage/
34}
35
36case "$1" in
37    configure)
38        /usr/lib/bareos/scripts/bareos-config deploy_config "@configtemplatedir@" "@confdir@" "bareos-sd" || true
39        permissions
40        /usr/lib/bareos/scripts/bareos-config setup_sd_user
41        # on Univention distributions the ucr command allows to open the firewall
42        if [ -x "/etc/init.d/univention-firewall" ] && which ucr >/dev/null 2>&1; then
43            ucr set \
44                security/packetfilter/package/bareos-storage/tcp/@sd_port@/all="ACCEPT" \
45                security/packetfilter/package/bareos-storage/tcp/@sd_port@/all/en="bareos-sd"
46            #invoke-rc.d univention-firewall restart
47        fi
48    ;;
49
50    abort-upgrade|abort-remove|abort-deconfigure)
51    ;;
52
53    *)
54        echo "postinst called with unknown argument \`$1'" >&2
55        exit 1
56    ;;
57esac
58
59# dh_installdeb will replace this with shell code automatically
60# generated by other debhelper scripts.
61
62#DEBHELPER#
63
64exit 0
65