9d3ca49387
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
44 lines
1.0 KiB
Bash
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
|