Fixing extjs check on cdh and mapr

On images generated from sahara-image-elements cluster is being stuck
due to double execution of the unzip code.

This fix prevents the code to be executed twice and in the case it does we
force unzip to overwrite.

Change-Id: I73836a516b839bdb368997af3693c139c1fff390
Story: #2002551
Task: #22113
This commit is contained in:
Telles Nobrega 2018-06-20 15:19:37 -03:00
parent b6a2addb96
commit 1ca25d1fd5
1 changed files with 19 additions and 11 deletions

View File

@ -4,19 +4,27 @@ EXTJS_DESTINATION_DIR="/opt/mapr-repository"
EXTJS_DOWNLOAD_URL="https://tarballs.openstack.org/sahara-extra/dist/common-artifacts/ext-2.2.zip"
EXTJS_NO_UNPACK=1
extjs_archive=/tmp/$(basename $EXTJS_DOWNLOAD_URL)
extjs_basepath=$(basename ${EXTJS_DOWNLOAD_URL})
extjs_archive=/tmp/${extjs_basepath}
extjs_folder="${extjs_basepath%.*}"
if [ ! -f "${EXTJS_DESTINATION_DIR}/${extjs_archive}" ]; then
if [ $test_only -eq 0 ]; then
wget -O $extjs_archive $EXTJS_DOWNLOAD_URL
function setup_extjs {
wget -O $extjs_archive $EXTJS_DOWNLOAD_URL
mkdir -p $EXTJS_DESTINATION_DIR
}
mkdir -p $EXTJS_DESTINATION_DIR
if [ -z "${EXTJS_NO_UNPACK:-}" ]; then
unzip -d "$EXTJS_DESTINATION_DIR" $extjs_archive
rm -f $extjs_archive
else
mv $extjs_archive $EXTJS_DESTINATION_DIR
fi
if [ -z "${EXTJS_NO_UNPACK:-}" ]; then
if [ ! -d "${EXTJS_DESTINATION_DIR}/${extjs_folder}" ]; then
setup_extjs
unzip -o -d "$EXTJS_DESTINATION_DIR" $extjs_archive
rm -f $extjs_archive
else
exit 0
fi
else
if [ ! -f "${EXTJS_DESTINATION_DIR}/${extjs_basepath}" ]; then
setup_extjs
mv $extjs_archive $EXTJS_DESTINATION_DIR
else
exit 0
fi