2 ## Copyright (C) 2019 Wind River Systems, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
18 file://${BPN}/guni_config.py \
19 file://${BPN}/horizon-assets-compress \
20 file://${BPN}/horizon-clearsessions \
21 file://${BPN}/horizon.init \
22 file://${BPN}/horizon-patching-restart \
23 file://${BPN}/openstack-dashboard-httpd-2.4.conf \
24 file://${BPN}/openstack-dashboard-httpd-logging.conf \
25 file://${BPN}/python-django-horizon-logrotate.conf \
26 file://${BPN}/python-django-horizon-systemd.conf \
29 do_configure_prepend () {
32 # STX remove troublesome files introduced by tox
33 rm -f openstack_dashboard/test/.secret_key_store
34 rm -f openstack_dashboard/test/*.secret_key_store.lock
35 rm -f openstack_dashboard/local/.secret_key_store
36 rm -f openstack_dashboard/local/*.secret_key_store.lock
37 rm -rf horizon.egg-info
40 cp -p ${WORKDIR}/${BPN}/openstack-dashboard-httpd-logging.conf .
41 cp -p ${WORKDIR}/${BPN}/guni_config.py .
43 # customize default settings
44 # WAS [PATCH] disable debug, move web root
45 sed -i "/^DEBUG =.*/c\DEBUG = False" openstack_dashboard/local/local_settings.py.example
46 sed -i "/^WEBROOT =.*/c\WEBROOT = '/dashboard/'" openstack_dashboard/local/local_settings.py.example
47 sed -i "/^.*ALLOWED_HOSTS =.*/c\ALLOWED_HOSTS = ['horizon.example.com', 'localhost']" openstack_dashboard/local/local_settings.py.example
48 sed -i "/^.*LOCAL_PATH =.*/c\LOCAL_PATH = '/tmp'" openstack_dashboard/local/local_settings.py.example
49 sed -i "/^.*POLICY_FILES_PATH =.*/c\POLICY_FILES_PATH = '/etc/openstack-dashboard'" openstack_dashboard/local/local_settings.py.example
51 sed -i "/^BIN_DIR = .*/c\BIN_DIR = '/usr/bin'" openstack_dashboard/settings.py
52 sed -i "/^COMPRESS_PARSER = .*/a COMPRESS_OFFLINE = True" openstack_dashboard/settings.py
54 # set COMPRESS_OFFLINE=True
55 sed -i 's:COMPRESS_OFFLINE.=.False:COMPRESS_OFFLINE = True:' openstack_dashboard/settings.py
57 # STX: MANIFEST needs .eslintrc files for angular
58 echo "include .eslintrc" >> MANIFEST.in
60 # MANIFEST needs to include json and pot files under openstack_dashboard
61 echo "recursive-include openstack_dashboard *.json *.pot .eslintrc" >> MANIFEST.in
63 # MANIFEST needs to include pot files under horizon
64 echo "recursive-include horizon *.pot .eslintrc" >> MANIFEST.in
67 do_install_append () {
71 install -d -m 755 ${D}/opt/branding
72 mkdir -p ${D}${sysconfdir}/rc.d/init.d
73 install -m 755 -D -p ${WORKDIR}/${BPN}/horizon.init ${D}${sysconfdir}/rc.d/init.d/horizon
74 install -m 755 -D -p ${WORKDIR}/${BPN}/horizon.init ${D}${sysconfdir}/init.d/horizon
75 install -m 755 -D -p ${WORKDIR}/${BPN}/horizon-clearsessions ${D}/${bindir}/horizon-clearsessions
76 install -m 755 -D -p ${WORKDIR}/${BPN}/horizon-patching-restart ${D}/${bindir}/horizon-patching-restart
77 install -m 755 -D -p ${WORKDIR}/${BPN}/horizon-assets-compress ${D}/${bindir}/horizon-assets-compress
79 # drop httpd-conf snippet
80 install -m 0644 -D -p ${WORKDIR}/${BPN}/openstack-dashboard-httpd-2.4.conf ${D}${sysconfdir}/httpd/conf.d/openstack-dashboard.conf
81 install -d -m 755 ${D}${datadir}/openstack-dashboard
82 install -d -m 755 ${D}${sysconfdir}/openstack-dashboard
84 # create directory for systemd snippet
85 mkdir -p ${D}${systemd_system_unitdir}/httpd.service.d/
86 cp ${WORKDIR}/${BPN}/python-django-horizon-systemd.conf ${D}${systemd_system_unitdir}/httpd.service.d/openstack-dashboard.conf
88 # Copy everything to /usr/share
89 mv ${D}${libdir}/python2.7/site-packages/openstack_dashboard \
90 ${D}${datadir}/openstack-dashboard
91 cp manage.py ${D}${datadir}/openstack-dashboard
94 cp guni_config.py ${D}${datadir}/openstack-dashboard
95 rm -rf ${D}${libdir}/python2.7/site-packages/openstack_dashboard
97 # remove unnecessary .po files
98 find ${D} -name django.po -exec rm '{}' \;
99 find ${D} -name djangojs.po -exec rm '{}' \;
101 # Move config to /etc, symlink it back to /usr/share
102 mv ${D}${datadir}/openstack-dashboard/openstack_dashboard/local/local_settings.py.example ${D}${sysconfdir}/openstack-dashboard/local_settings
104 mv ${D}${datadir}/openstack-dashboard/openstack_dashboard/conf/*.json ${D}${sysconfdir}/openstack-dashboard
105 cp -a ${S}/openstack_dashboard/conf/cinder_policy.d ${D}${sysconfdir}/openstack-dashboard
106 cp -a ${S}/openstack_dashboard/conf/nova_policy.d ${D}${sysconfdir}/openstack-dashboard
108 # copy static files to ${datadir}/openstack-dashboard/static
109 mkdir -p ${D}${datadir}/openstack-dashboard/static
110 cp -a openstack_dashboard/static/* ${D}${datadir}/openstack-dashboard/static
111 cp -a horizon/static/* ${D}${datadir}/openstack-dashboard/static
113 # create /var/run/openstack-dashboard/ and /var/log/horizon
114 install -m 0755 -d ${D}/${sysconfdir}/tmpfiles.d
115 echo "d ${localstatedir}/run/openstack-dashboard 0755 root root -" >> ${D}/${sysconfdir}/tmpfiles.d/openstack-dashboard.conf
116 echo "d ${localstatedir}/log/horizon 0755 root root -" >> ${D}/${sysconfdir}/tmpfiles.d/openstack-dashboard.conf
118 # place logrotate config:
119 mkdir -p ${D}${sysconfdir}/logrotate.d
120 cp -a ${WORKDIR}/${BPN}/python-django-horizon-logrotate.conf ${D}${sysconfdir}/logrotate.d/openstack-dashboard
122 chown -R root:root ${D}
126 ${datadir}/openstack-dashboard \
127 ${systemd_system_unitdir} \
132 RPROVIDES_${PN} = "openstack-dashboard"