File: barbican-common.postinst.in

package info (click to toggle)
barbican 1%3A11.0.0-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,504 kB
  • sloc: python: 44,019; sh: 953; makefile: 70
file content (46 lines) | stat: -rwxr-xr-x 1,303 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -e

CONF=/etc/barbican/barbican.conf
API_CONF=/etc/barbican/barbican-api-paste.ini

#PKGOS-INCLUDE#

if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
	. /usr/share/debconf/confmodule
	. /usr/share/dbconfig-common/dpkg/postinst

	pkgos_var_user_group barbican
	mkdir -p /var/lib/barbican/temp
	chown barbican:barbican /var/lib/barbican/temp

	pkgos_write_new_conf barbican api_audit_map.conf
	pkgos_write_new_conf barbican barbican-api-paste.ini
	pkgos_write_new_conf barbican barbican.conf
	pkgos_write_new_conf barbican barbican-functional.conf
        if [ -r /etc/barbican/policy.json ] ; then
                mv /etc/barbican/policy.json /etc/barbican/disabled.policy.json.old
        fi

        db_get barbican/configure_db
        if [ "$RET" = "true" ]; then
                pkgos_dbc_postinst ${CONF} DEFAULT sql_connection barbican $@
        fi

        pkgos_rabbit_write_conf ${CONF} DEFAULT barbican
        pkgos_write_admin_creds ${CONF} keystone_authtoken barbican

	db_get barbican/configure_db
	if [ "$RET" = "true" ]; then
		echo "Now calling barbican-db-manage upgrade: this may take a while..."
#		echo "TODO: barbican-db-manage upgrade: Disabled for now..."
		su -s /bin/sh -c 'barbican-db-manage upgrade' barbican
	fi

	db_stop
fi

#DEBHELPER#

exit 0