meta-starlingx/meta-stx-cloud/recipes-devtools/python/files/python-django-horizon/horizon-assets-compress
Saul Wold 6bec67b9bf erlang, openstack python ruby-shadow: Move to meta-stx-clould
These are all Cloud services related so move here

Signed-off-by: Saul Wold <sgw@linux.intel.com>
2020-05-17 16:00:29 -07: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="/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