#!/bin/sh # vim: set ts=2 et: set -e CONF="openstack-dashboard.conf" if [ "$1" = "configure" ]; then # /etc/apache2/conf.d/dashboard.conf -> /etc/apache2/conf-available/openstack-dashboard.conf dpkg-maintscript-helper mv_conffile \ /etc/apache2/conf.d/dashboard.conf /etc/apache2/conf-available/$CONF \ 2012.1~rc1-0ubuntu1 -- "$@" # Transition config to apache 2.4 compatable location. dpkg-maintscript-helper mv_conffile \ /etc/apache2/conf.d/$CONF \ /etc/apache2/conf-available/$CONF \ 1:2013.2~b2-0ubuntu3 -- "$@" if ! getent group horizon > /dev/null 2>&1 then addgroup --system horizon >/dev/null fi if ! getent passwd horizon > /dev/null 2>&1 then adduser --system --home /usr/share/openstack-dashboard/ --ingroup horizon \ --no-create-home --shell /bin/false horizon fi ( cd /usr/share/openstack-dashboard echo "Collecting and compressing static assets..." rm -rf ./static/horizon 2>&1 > /dev/null python manage.py collectstatic --noinput 2>&1 > /dev/null python manage.py compress --force 2>&1 > /dev/null ) if [ -e /usr/share/openstack-dashboard/openstack_dashboard/static ] ; then chown -R horizon:horizon \ /usr/share/openstack-dashboard/openstack_dashboard/static fi if [ -d /usr/share/openstack-dashboard/openstack_dashboard/locale -a -e /usr/share/openstack-dashboard/manage.py ] ; then curdir="`pwd`" cd /usr/share/openstack-dashboard/openstack_dashboard python ../manage.py compilemessages cd "$curdir" else echo "Couldn't compile Django l10n strings (.mo files)" fi if [ -d /etc/openstack-dashboard/ ] ; then chown horizon:horizon /etc/openstack-dashboard/ fi A22_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then # apache 2.4 . /usr/share/apache2/apache2-maintscript-helper apache2_invoke enconf $CONF || exit $? elif [ "$A22_STATE" = "installed" ] || [ "$A22_STATE" = "unpacked" ] ; then # apache 2.2 [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/$CONF ] && ln -s ../conf-available/$CONF /etc/apache2/conf.d/$CONF [ -x /etc/init.d/apache2 ] && invoke-rc.d --quiet apache2 reload fi if [ -d /var/lib/openstack-dashboard ] ; then # Generated secret storage for single node use - see local_settings.py # for more details of SECRET_KEY chmod 0700 /var/lib/openstack-dashboard if [ -f /etc/openstack-dashboard/secret_key ]; then mv /etc/openstack-dashboard/secret_key /var/lib/openstack-dashboard fi chown -R horizon:horizon /var/lib/openstack-dashboard fi fi if [ "$1" = "triggered" ] ; then /usr/share/openstack-dashboard/manage.py compress --force fi #DEBHELPER#