2015-06-23 21:02:01 +03:00
|
|
|
#!/usr/bin/env bash
|
2016-02-27 23:51:18 +03:00
|
|
|
repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
cd $repoFolder
|
2014-09-10 01:11:43 +04:00
|
|
|
|
2016-06-15 02:23:39 +03:00
|
|
|
koreBuildZip="https://github.com/aspnet/KoreBuild/archive/release.zip"
|
2016-02-27 23:51:18 +03:00
|
|
|
if [ ! -z $KOREBUILD_ZIP ]; then
|
|
|
|
koreBuildZip=$KOREBUILD_ZIP
|
2014-09-10 01:11:43 +04:00
|
|
|
fi
|
|
|
|
|
2016-02-27 23:51:18 +03:00
|
|
|
buildFolder=".build"
|
|
|
|
buildFile="$buildFolder/KoreBuild.sh"
|
2014-09-10 01:11:43 +04:00
|
|
|
|
2016-02-11 01:55:49 +03:00
|
|
|
if test ! -d $buildFolder; then
|
2016-02-27 23:51:18 +03:00
|
|
|
echo "Downloading KoreBuild from $koreBuildZip"
|
|
|
|
|
|
|
|
tempFolder="/tmp/KoreBuild-$(uuidgen)"
|
|
|
|
mkdir $tempFolder
|
|
|
|
|
|
|
|
localZipFile="$tempFolder/korebuild.zip"
|
|
|
|
|
2016-03-08 07:55:07 +03:00
|
|
|
retries=6
|
|
|
|
until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null)
|
|
|
|
do
|
|
|
|
echo "Failed to download '$koreBuildZip'"
|
|
|
|
if [ "$retries" -le 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
retries=$((retries - 1))
|
|
|
|
echo "Waiting 10 seconds before retrying. Retries left: $retries"
|
|
|
|
sleep 10s
|
|
|
|
done
|
|
|
|
|
2016-02-27 23:51:18 +03:00
|
|
|
unzip -q -d $tempFolder $localZipFile
|
|
|
|
|
2016-02-11 01:55:49 +03:00
|
|
|
mkdir $buildFolder
|
2016-02-27 23:51:18 +03:00
|
|
|
cp -r $tempFolder/**/build/** $buildFolder
|
|
|
|
|
|
|
|
chmod +x $buildFile
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
if test ! -d $tempFolder; then
|
|
|
|
rm -rf $tempFolder
|
2016-02-11 01:55:49 +03:00
|
|
|
fi
|
2014-09-10 01:11:43 +04:00
|
|
|
fi
|
|
|
|
|
2016-03-08 07:55:07 +03:00
|
|
|
$buildFile -r $repoFolder "$@"
|