From: Thomas Goirand Date: Fri, 14 Jun 2013 18:45:25 +0000 (+0800) Subject: Added a /etc/defaults/openstack-dashboard-apache to save the values of debconf for... X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=83f6336c1941079f834c09a24d3b5182ee50f5fa;p=openstack-build%2Fhorizon-build.git Added a /etc/defaults/openstack-dashboard-apache to save the values of debconf for setting-up apache vhosts. Rewritten-From: 61eb48465bfded8724f304e603902cf2a10d0fe3 --- diff --git a/trusty/debian/changelog b/trusty/debian/changelog index a304ee9..1d035f7 100644 --- a/trusty/debian/changelog +++ b/trusty/debian/changelog @@ -1,3 +1,10 @@ +horizon (2013.1.2-2) unstable; urgency=low + + * Added a /etc/default/openstack-dashboard-apache to save the values of + debconf about setting-up the Apache vhosts. + + -- Thomas Goirand Sat, 15 Jun 2013 02:45:58 +0800 + horizon (2013.1.2-1) unstable; urgency=low * New upstream release. diff --git a/trusty/debian/openstack-dashboard-apache.config b/trusty/debian/openstack-dashboard-apache.config index 76b4bb2..bee638e 100644 --- a/trusty/debian/openstack-dashboard-apache.config +++ b/trusty/debian/openstack-dashboard-apache.config @@ -4,11 +4,27 @@ set -e . /usr/share/debconf/confmodule +if [ -r /etc/default/openstack-dashboard-apache ] ; then + . /etc/default/openstack-dashboard-apache +fi + +if [ "${HORIZON_ACTIVATE_VHOSTS}" = "true" ] || [ "${HORIZON_ACTIVATE_VHOSTS}" = "yes" ] ; then + db_set horizon/activate_vhost true +else + db_set horizon/activate_vhost false +fi + db_input high horizon/activate_vhost || true db_go || true db_get horizon/activate_vhost if [ "${RET}" = "true" ] ; then + if [ "${HORIZON_USE_SSL}" = "true" ] || [ "${HORIZON_USE_SSL}" = "yes" ] ; then + db_set horizon/use_ssl true + else + db_set horizon/use_ssl false + fi + db_input high horizon/use_ssl || true db_go || true fi diff --git a/trusty/debian/openstack-dashboard-apache.postinst b/trusty/debian/openstack-dashboard-apache.postinst index 57076f3..da446d9 100644 --- a/trusty/debian/openstack-dashboard-apache.postinst +++ b/trusty/debian/openstack-dashboard-apache.postinst @@ -3,23 +3,44 @@ set -e if [ "$1" = "configure" ] ; then - . /usr/share/debconf/confmodule - db_get horizon/activate_vhost - if [ "${RET}" = "true" ] && [ -x /etc/init.d/apache2 ] ; then + . /usr/share/debconf/confmodule + if ! [ -f /etc/default/openstack-dashboard-apache ] ; then + echo "# This file controls the behavior of the +# Apache installation / upgrade. + +# Controls if the Apache \"default\" site provided by the Debian +# Apache package should be disabled, and the \"openstack-dashboard\" +# virtual host enabled. If set to no, then you will have to do the +# setup manually. +HORIZON_ACTIVATE_VHOSTS=yes + +# If the above HORIZON_ACTIVATE_VHOSTS is set to yes, the +# below directive is set to yes also, then Horizon will +# be setup using SSL, and any query to the non-SSL site +# will be redirected to the SSL site. +HORIZON_USE_SSL=yes" >/etc/default/openstack-dashboard-apache + fi + db_get horizon/activate_vhost + if [ "${RET}" = "true" ] && [ -x /etc/init.d/apache2 ] ; then + sed -i 's#[ \t]*HORIZON_ACTIVATE_VHOSTS=.*#HORIZON_ACTIVATE_VHOSTS=yes#' /etc/default/openstack-dashboard-apache a2dissite default db_get horizon/use_ssl if [ "${RET}" = "true" ] ; then + sed -i 's#[ \t]*HORIZON_USE_SSL=.*#HORIZON_USE_SSL=yes#' /etc/default/openstack-dashboard-apache a2enmod ssl a2enmod rewrite a2dissite openstack-dashboard a2ensite openstack-dashboard-ssl-redirect a2ensite openstack-dashboard-ssl else + sed -i 's#[ \t]*HORIZON_USE_SSL=.*#HORIZON_USE_SSL=no#' /etc/default/openstack-dashboard-apache a2dissite openstack-dashboard-ssl a2dissite openstack-dashboard-ssl-redirect a2ensite openstack-dashboard fi invoke-rc.d --quiet apache2 reload + else + sed -i 's#[ \t]*HORIZON_ACTIVATE_VHOSTS=.*#HORIZON_ACTIVATE_VHOSTS=no#' /etc/default/openstack-dashboard-apache fi db_stop fi diff --git a/trusty/debian/openstack-dashboard-apache.postrm b/trusty/debian/openstack-dashboard-apache.postrm new file mode 100644 index 0000000..e3bebbf --- /dev/null +++ b/trusty/debian/openstack-dashboard-apache.postrm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ "${1}" = "purge" ] ; then + if [ -f /etc/default/openstack-dashboard-apache ] ; then + rm -rf /etc/default/openstack-dashboard-apache + fi +fi + +#DEBHELPER# diff --git a/trusty/debian/openstack-dashboard-apache.prerm b/trusty/debian/openstack-dashboard-apache.prerm index 0068cfb..d0149a6 100644 --- a/trusty/debian/openstack-dashboard-apache.prerm +++ b/trusty/debian/openstack-dashboard-apache.prerm @@ -2,8 +2,10 @@ set -e -a2dissite openstack-dashboard -a2dissite openstack-dashboard-ssl-redirect -a2dissite openstack-dashboard-ssl +if [ -x /usr/sbin/a2dissite ] ; then + a2dissite openstack-dashboard + a2dissite openstack-dashboard-ssl-redirect + a2dissite openstack-dashboard-ssl +fi -#DEBHELPER# \ No newline at end of file +#DEBHELPER#