File: watcher-common.postinst.in

package info (click to toggle)
watcher 0.30.0-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,788 kB
  • ctags: 4,126
  • sloc: python: 26,555; sh: 255; makefile: 60
file content (38 lines) | stat: -rw-r--r-- 1,011 bytes parent folder | download
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
#!/bin/sh

set -e

WATCHER_CONF=/etc/watcher/watcher.conf

#PKGOS-INCLUDE#

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

	pkgos_var_user_group watcher

	# Needed at runtime
	mkdir -p /var/cache/watcher
	chown watcher:watcher /var/cache/watcher

	pkgos_write_new_conf watcher policy.json
	pkgos_write_new_conf watcher watcher.conf
	db_get watcher/configure_db
	if [ "$RET" = "true" ]; then
		pkgos_dbc_postinst ${WATCHER_CONF} database connection watcher $@
	fi
	pkgos_rabbit_write_conf ${WATCHER_CONF} oslo_messaging_rabbit watcher
	pkgos_write_admin_creds ${WATCHER_CONF} keystone_authtoken watcher

	db_get watcher/configure_db
	if [ "$RET" = "true" ]; then
		echo "Now calling watcher-db-manage --config-file /etc/watcher/watcher.conf create_schema: this may take a while..."
		su -s /bin/sh -c 'watcher-db-manage --config-file /etc/watcher/watcher.conf create_schema' watcher
	fi
	db_stop
fi

#DEBHELPER#

exit 0