Custom Search

Wednesday, April 23, 2014

How to Horizon packaging copy /etc/apache2/openstack-dashboard.conf

1)
#ls debian/

changelog  openstack-dashboard.conf      openstack-dashboard.preinst                patches                                  source
compat     openstack-dashboard.dirs      openstack-dashboard-ubuntu-theme.dirs      pydist-overrides                         static
conffile   openstack-dashboard.install   openstack-dashboard-ubuntu-theme.install   python-django-horizon.install            theme
control    openstack-dashboard.links     openstack-dashboard-ubuntu-theme.links     python-django-horizon.lintian-overrides  watch
copyright  openstack-dashboard.postinst  openstack-dashboard-ubuntu-theme.postinst  README.compression
gbp.conf   openstack-dashboard.postrm    openstack-dashboard-ubuntu-theme.postrm    rules

2)
#vim ./debian/openstack-dashboard.install

debian/openstack-dashboard.conf etc/apache2/conf-available <===
etc/openstack-dashboard
usr/share/openstack-dashboard
horizon usr/share/openstack-dashboard
horizon_mycloud usr/share/openstack-dashboard
horizon_mycloud/static/* usr/share/openstack-dashboard/openstack_dashboard/static/
debian/static/openstack-dashboard/manifest.json usr/share/openstack-dashboard/openstack_dashboard/static/dashboard
debian/static/openstack-dashboard/css/* usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/css
debian/static/openstack-dashboard/js/* usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/js

3)
#vim ./debian/openstack-dashboard.preinst

#!/bin/sh
# vim: set ts=2 et:

set -e

# /etc/apache2/conf.d/dashboard.conf -> /etc/apache2/conf.d/openstack-dashboard.conf
dpkg-maintscript-helper mv_conffile \
  /etc/apache2/conf.d/dashboard.conf /etc/apache2/conf.d/openstack-dashboard.conf \
  2012.1~rc1-0ubuntu1 -- "$@"


# Transition config to apache 2.4 compatable location.
dpkg-maintscript-helper mv_conffile \
  /etc/apache2/conf.d/openstack-dashboard.conf \
  /etc/apache2/conf-available/openstack-dashboard.conf \
  1:2013.2~b2-0ubuntu3 -- "$@"


4)
vim ./debian/openstack-dashboard.postinst

#!/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

  if [ -e /usr/share/openstack-dashboard/openstack_dashboard/static ] ; then
    chown -R horizon:horizon \
      /usr/share/openstack-dashboard/openstack_dashboard/static
  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

No comments:

Post a Comment