fgmeta/release_builder/create_base_package.sh
Automatic Release Builder a83dd79e81 Fix base package creation script
Ensure the scenery pack is extracted correctly
2021-06-09 14:04:07 +01:00

65 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
#####################################################################################
if [ "$WORKSPACE" == "" ]; then
echo "ERROR: Missing WORKSPACE environment variable."
exit 1
fi
if [ ! -d "$WORKSPACE/fgdata" ]; then
echo "No fgdata subdir in WORKSPACE: can't continue"
exit 1
fi
VERSION=`cat fgdata/version`
BASE_VERSION_TAG="version/2020.3.1"
SCENERY_PACK_AIRPORT=BIKF
SCENERY_PACK_URI="https://sourceforge.net/projects/flightgear/files/scenery/SceneryPack.${SCENERY_PACK_AIRPORT}.tgz/download"
echo "Assembling base package for $VERSION"
cd $WORKSPACE
# wipe directories and re-create
rm -rf staging
mkdir -p output
mkdir -p staging
# wipe existing data TXZs
rm output/FlightGear-$VERSION*data.txz
rsync -az --exclude=".git" --exclude="Textures/Unused" --exclude="*.xcf" fgdata staging/
# add all the scenery pack files into it
SCENERY_PACK_NAME=SceneryPack_${SCENERY_PACK_AIRPORT}.tgz
# Should we re-download the SceneryPack periodically? Or just rely on doing a workspace wipe?
if [ ! -f $SCENERY_PACK_NAME ]; then
echo "Downloading scenery pack from ${SCENERY_PACK_URI}"
# -L to follow the SF redirect
curl -L $SCENERY_PACK_URI --output $SCENERY_PACK_NAME
fi
pushd staging/fgdata/Scenery
tar -xf $WORKSPACE/$SCENERY_PACK_NAME --strip-components=1
popd
# Creating full base package TXZ
OUTPUT_NAME=FlightGear-$VERSION-data
tar -cJf output/$OUTPUT_NAME.txz --directory staging fgdata
echo "Creating updates package"
pushd fgdata
git diff --name-only --line-prefix="fgdata/" $BASE_VERSION_TAG..HEAD > ../fgdata_changes
popd
tar -cJf output/FlightGear-$VERSION-update-data.txz -T fgdata_changes
echo "Done, data TXZs are in output/"