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
|
#!/bin/sh
set -e
CONF=/etc/vmms/vmms.conf
#PKGOS-INCLUDE#
if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst
pkgos_var_user_group vmms
pkgos_write_new_conf vmms vmms.conf
# Configure the db
db_get vmms/configure_db
if [ "$RET" = "true" ]; then
pkgos_dbc_postinst ${CONF} database connection vmms $@
fi
# Configure [keystone_authtoken]
pkgos_write_admin_creds ${CONF} keystone_authtoken vmms
# Do the db_sync
db_get vmms/configure_db
if [ "$RET" = "true" ]; then
echo "Now calling vmms-manage db_sync: this may take a while..."
su -s /bin/sh -c 'vmms-manage db_sync' vmms
fi
db_stop
# Generate an ssh key if it doesn't exist
mkdir -p /etc/vmms/.ssh
chown vmms:vmms /etc/vmms/.ssh
chmod 700 /etc/vmms/.ssh
if ! [ -e /etc/vmms/.ssh/id_rsa ] ; then
ssh-keygen -t rsa -b 4096 -f /etc/vmms/.ssh/id_rsa -N ""
fi
if [ -e /etc/vmms/.ssh/id_rsa ] && [ -e /etc/vmms/.ssh/id_rsa.pub ] ; then
chown vmms:vmms /etc/vmms/.ssh/id_rsa /etc/vmms/.ssh/id_rsa.pub
fi
fi
#DEBHELPER#
exit 0
|