upstream/openstack/python-horizon/files/horizon-assets-compress
Scott Little 56b2f7497e Remove CentOS/OpenSUSE build support
StarlingX stopped supporting CentOS builds in the after release 7.0.
This update will strip CentOS from our code base.  It will also remove
references to the failed OpenSUSE feature as well.

Story: 2011110
Task: 49963
Change-Id: I2979f438571d872bcb43b5424549c824a8a86c30
Signed-off-by: Scott Little <scott.little@windriver.com>
2024-05-02 15:47:23 -04:00

44 lines
1.0 KiB
Bash

#!/bin/bash
#
# Copyright (c) 2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
PYTHON=`which python`
MANAGE="/usr/share/openstack-dashboard/manage.py"
STATICDIR="/var/www/pages/static"
BRANDDIR="/opt/branding"
APPLIEDDIR="/opt/branding/applied"
# Handle custom horizon branding
rm -rf ${APPLIEDDIR}
if ls ${BRANDDIR}/*.tgz 1> /dev/null 2>&1; then
LATESTBRANDING=$(ls $BRANDDIR |grep '\.tgz$' | tail -n 1)
mkdir -p ${APPLIEDDIR}
tar zxf ${BRANDDIR}/${LATESTBRANDING} -C ${APPLIEDDIR} 2>/dev/null 1>/dev/null
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "Failed to extract ${BRANDDIR}/${LATESTBRANDING}"
fi
fi
echo "Dumping static assets"
if [ -d ${STATICDIR} ]; then
COLLECTARGS=--clear
fi
${PYTHON} -- ${MANAGE} collectstatic -v0 --noinput ${COLLECTARGS}
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "Failed to dump static assets."
exit $RETVAL
fi
nice -n 20 ionice -c Idle ${PYTHON} -- ${MANAGE} compress -v0
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "Failed to compress assets."
exit $RETVAL
fi