From 0e99f114a16c7943a8837c6981fc236c117f19d2 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Mon, 29 Apr 2019 21:04:47 -0400 Subject: [PATCH] add offline install --- webapp/reset-minetest-install-source.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/webapp/reset-minetest-install-source.sh b/webapp/reset-minetest-install-source.sh index 65fcea0..bfacc8a 100755 --- a/webapp/reset-minetest-install-source.sh +++ b/webapp/reset-minetest-install-source.sh @@ -20,6 +20,15 @@ customDie () { echo "$1" exit 1 } +enable_offline=false +for var in "$@" +do + if [ "@$var" = "@--offline" ]; then + enable_offline=true + else + customDie "Invalid argument: $var" + fi +done if [ -d "$extracted_name" ]; then if [ "`ls -lR screenshots/*.png | wc -l`" -gt 0 ]; then mv screenshots/*.png ~/ || customDie "can't move screenshots from $extracted_name/minetest/bin/*.png" @@ -33,7 +42,13 @@ if [ -d "$extracted_name" ]; then rm -Rf "$extracted_name" || customDie "can't remove $extracted_name" fi -wget -O $zip_name $url/$zip_name || customDie "no $zip_name at $url" +if [ "@$enable_offline" = "@true" ]; then + if [ ! -f "$zip_name" ]; then + customDie "* Offline install is impossible without '`pwd`/$zip_name'." + fi +else + wget -O $zip_name $url/$zip_name || customDie "no $zip_name at $url" +fi unzip -u $zip_name || customDie "Can't unzip $zip_name" cd "$extracted_name" echo "compiling libraries..."