Update script

This commit is contained in:
nsubiron 2017-11-27 13:15:49 +01:00
parent 7b41eca6f1
commit e3ae00c562
2 changed files with 48 additions and 36 deletions

View File

@ -22,45 +22,12 @@ command -v clang++-3.9 >/dev/null 2>&1 || {
exit 1;
}
# Update content.
./Update.sh
mkdir -p Util/Build
pushd Util/Build >/dev/null
# ==============================================================================
# -- Download the content ------------------------------------------------------
# ==============================================================================
CONTENT_FOLDER=$SCRIPT_DIR/Unreal/CarlaUE4/Content
CONTENT_GDRIVE_ID=$(tac $SCRIPT_DIR/Util/ContentVersions.txt | egrep -m 1 . | rev | cut -d' ' -f1 | rev)
VERSION_FILE=${CONTENT_FOLDER}/.version
function download_content {
if [[ -d "$CONTENT_FOLDER" ]]; then
echo "Backing up existing Content..."
mv -v "$CONTENT_FOLDER" "${CONTENT_FOLDER}_$(date +%Y%m%d%H%M%S)"
fi
mkdir -p $CONTENT_FOLDER
mkdir -p Content
../download_from_gdrive.py $CONTENT_GDRIVE_ID Content.tar.gz
tar -xvzf Content.tar.gz -C Content
rm Content.tar.gz
mv Content/* $CONTENT_FOLDER
echo "$CONTENT_GDRIVE_ID" > "$VERSION_FILE"
}
if [[ -d "$CONTENT_FOLDER/.git" ]]; then
echo "Using git version of 'Content', skipping download..."
elif [[ -f "$CONTENT_FOLDER/.version" ]]; then
if [ "$CONTENT_GDRIVE_ID" == `cat $VERSION_FILE` ]; then
echo "Content is up-to-date, skipping download..."
else
download_content
fi
else
download_content
fi
# ==============================================================================
# -- Get and compile libc++ ----------------------------------------------------
# ==============================================================================

45
Update.sh Executable file
View File

@ -0,0 +1,45 @@
#! /bin/bash
################################################################################
# Updates CARLA contents.
################################################################################
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd "$SCRIPT_DIR" >/dev/null
CONTENT_FOLDER=$SCRIPT_DIR/Unreal/CarlaUE4/Content
CONTENT_GDRIVE_ID=$(tac $SCRIPT_DIR/Util/ContentVersions.txt | egrep -m 1 . | rev | cut -d' ' -f1 | rev)
VERSION_FILE=${CONTENT_FOLDER}/.version
function download_content {
if [[ -d "$CONTENT_FOLDER" ]]; then
echo "Backing up existing Content..."
mv -v "$CONTENT_FOLDER" "${CONTENT_FOLDER}_$(date +%Y%m%d%H%M%S)"
fi
mkdir -p $CONTENT_FOLDER
mkdir -p Content
./Util/download_from_gdrive.py $CONTENT_GDRIVE_ID Content.tar.gz
tar -xvzf Content.tar.gz -C Content
rm Content.tar.gz
mv Content/* $CONTENT_FOLDER
echo "$CONTENT_GDRIVE_ID" > "$VERSION_FILE"
echo "Content updated successfully."
}
if [[ -d "$CONTENT_FOLDER/.git" ]]; then
echo "Using git version of 'Content', skipping update."
elif [[ -f "$CONTENT_FOLDER/.version" ]]; then
if [ "$CONTENT_GDRIVE_ID" == `cat $VERSION_FILE` ]; then
echo "Content is up-to-date."
else
download_content
fi
else
download_content
fi
popd >/dev/null