From e1b1070bcfcb8f2bd89e47c7adee831fe168f6af Mon Sep 17 00:00:00 2001 From: fusion809 Date: Sun, 15 Jul 2018 17:43:21 +1000 Subject: [PATCH] Adding wget support to fetch scripts --- packaging/linux/buildpackage.sh | 12 +++++++++--- thirdparty/fetch-geoip-db.sh | 6 +++++- thirdparty/fetch-thirdparty-deps.sh | 24 +++++++++++++++++++----- thirdparty/noget.sh | 10 ++++++++-- 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/packaging/linux/buildpackage.sh b/packaging/linux/buildpackage.sh index f25a010dc5..860a2d510d 100755 --- a/packaging/linux/buildpackage.sh +++ b/packaging/linux/buildpackage.sh @@ -5,7 +5,7 @@ set -e command -v make >/dev/null 2>&1 || { echo >&2 "Linux packaging requires make."; exit 1; } command -v python >/dev/null 2>&1 || { echo >&2 "Linux packaging requires python."; exit 1; } command -v tar >/dev/null 2>&1 || { echo >&2 "Linux packaging requires tar."; exit 1; } -command -v curl >/dev/null 2>&1 || { echo >&2 "Linux packaging requires curl."; exit 1; } +command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Linux packaging requires curl or wget."; exit 1; } DEPENDENCIES_TAG="20180723" @@ -55,8 +55,14 @@ popd > /dev/null # Add native libraries echo "Downloading dependencies" -curl -s -L -O https://github.com/OpenRA/AppImageSupport/releases/download/${DEPENDENCIES_TAG}/libs.tar.bz2 || exit 3 -curl -s -L -O https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3 +if command -v curl >/dev/null 2>&1; then + curl -s -L -O https://github.com/OpenRA/AppImageSupport/releases/download/${DEPENDENCIES_TAG}/libs.tar.bz2 || exit 3 + curl -s -L -O https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3 +else + wget -cq https://github.com/OpenRA/AppImageSupport/releases/download/${DEPENDENCIES_TAG}/libs.tar.bz2 || exit 3 + wget -cq https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3 +fi + chmod a+x appimagetool-x86_64.AppImage echo "Building AppImage" diff --git a/thirdparty/fetch-geoip-db.sh b/thirdparty/fetch-geoip-db.sh index 7fb5840161..d1325a1175 100755 --- a/thirdparty/fetch-geoip-db.sh +++ b/thirdparty/fetch-geoip-db.sh @@ -13,6 +13,10 @@ filename="GeoLite2-Country.mmdb.gz" if [ ! -e $filename ] || [ -n "$(find . -name $filename -mtime +30 -print)" ]; then rm -f $filename echo "Updating GeoIP country database from MaxMind." - curl -s -L -O http://geolite.maxmind.com/download/geoip/database/$filename + if command -v curl >/dev/null 2>&1; then + curl -s -L -O http://geolite.maxmind.com/download/geoip/database/$filename + else + wget -cq http://geolite.maxmind.com/download/geoip/database/$filename + fi fi diff --git a/thirdparty/fetch-thirdparty-deps.sh b/thirdparty/fetch-thirdparty-deps.sh index 931d9b19b6..8d49b4a87f 100755 --- a/thirdparty/fetch-thirdparty-deps.sh +++ b/thirdparty/fetch-thirdparty-deps.sh @@ -81,19 +81,33 @@ fi if [ ! -f SDL2-CS.dll -o ! -f SDL2-CS.dll.config ]; then echo "Fetching SDL2-CS from GitHub." - curl -s -L -O https://github.com/OpenRA/SDL2-CS/releases/download/20161223/SDL2-CS.dll - curl -s -L -O https://github.com/OpenRA/SDL2-CS/releases/download/20161223/SDL2-CS.dll.config + if command -v curl >/dev/null 2>&1; then + curl -s -L -O https://github.com/OpenRA/SDL2-CS/releases/download/20161223/SDL2-CS.dll + curl -s -L -O https://github.com/OpenRA/SDL2-CS/releases/download/20161223/SDL2-CS.dll.config + else + wget -cq https://github.com/OpenRA/SDL2-CS/releases/download/20161223/SDL2-CS.dll + wget -cq https://github.com/OpenRA/SDL2-CS/releases/download/20161223/SDL2-CS.dll.config + fi fi if [ ! -f OpenAL-CS.dll -o ! -f OpenAL-CS.dll.config ]; then echo "Fetching OpenAL-CS from GitHub." - curl -s -L -O https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll - curl -s -L -O https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll.config + if command -v curl >/dev/null 2>&1; then + curl -s -L -O https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll + curl -s -L -O https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll.config + else + wget -cq https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll + wget -cq https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/OpenAL-CS.dll.config + fi fi if [ ! -f Eluant.dll ]; then echo "Fetching Eluant from GitHub." - curl -s -L -O https://github.com/OpenRA/Eluant/releases/download/20160124/Eluant.dll + if command -v curl >/dev/null 2>&1; then + curl -s -L -O https://github.com/OpenRA/Eluant/releases/download/20160124/Eluant.dll + else + wget -cq https://github.com/OpenRA/Eluant/releases/download/20160124/Eluant.dll + fi fi if [ ! -f rix0rrr.BeaconLib.dll ]; then diff --git a/thirdparty/noget.sh b/thirdparty/noget.sh index 066d268701..6e9208a829 100755 --- a/thirdparty/noget.sh +++ b/thirdparty/noget.sh @@ -6,8 +6,14 @@ # Copy-paste the entire script into http://shellcheck.net to check. #### +command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Obtaining thirdparty dependencies requires curl or wget."; exit 1; } + archive="$1" version="$2" -curl -o "$archive.zip" -Ls https://nuget.org/api/v2/package/"$archive"/"$version" +if command -v curl >/dev/null 2>&1; then + curl -o "$archive.zip" -Ls https://nuget.org/api/v2/package/"$archive"/"$version" +else + wget -cq https://nuget.org/api/v2/package/"$archive"/"$version" -O "$archive.zip" +fi mkdir -p "$archive" -unzip -o -qq "$archive.zip" -d "$archive" && rm "$archive.zip" \ No newline at end of file +unzip -o -qq "$archive.zip" -d "$archive" && rm "$archive.zip"