From a0f0ac8134d314ecc811ceefff48d328065a375e Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Wed, 9 Oct 2019 21:14:25 -0400 Subject: [PATCH] download MultiCraft default game during build --- build-MultiCraft.sh | 59 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/build-MultiCraft.sh b/build-MultiCraft.sh index 9058263..092cffd 100755 --- a/build-MultiCraft.sh +++ b/build-MultiCraft.sh @@ -5,6 +5,13 @@ # cmake . -DOpenGL_GL_PREFERENCE=GLVND && make me="$0" +OFFLINE=false +if [ "@$1" = "@--offline" ]; then + OFFLINE=true +fi +if [ "@$2" = "@--offline" ]; then + OFFLINE=true +fi customDie() { echo echo @@ -13,19 +20,36 @@ customDie() { echo exit 1 } -if [ ! -d "$HOME/Downloads/git/MultiCraft" ]; then - mkdir -p "$HOME/Downloads/git/MultiCraft" +dieIfOnline() { + echo + echo + if [ "@$OFFLINE" = "@false" ]; then + echo "$me ERROR:" + echo $1 + echo + exit 1 + else + echo "$me WARNING:" + echo $1 + echo + fi +} +GIT_USER_DIR="$HOME/Downloads/git/MultiCraft" +if [ ! -d "$GIT_USER_DIR" ]; then + mkdir -p "$GIT_USER_DIR" fi -cd $HOME/Downloads/git/MultiCraft || customDie "cd $HOME/Downloads/git/MultiCraft FAILED" +cd $GIT_USER_DIR || customDie "cd $GIT_USER_DIR FAILED" goodFlagFile=MultiCraft/CMakeLists.txt if [ -f "`which git`" ]; then echo "In `pwd`..." if [ ! -d MultiCraft ]; then - git clone https://github.com/MultiCraft/MultiCraft.git || customDie "Cannot clone MultiCraft from `pwd`" + if [ "@$OFFLINE" = "@false" ]; then + git clone https://github.com/MultiCraft/MultiCraft.git || customDie "Cannot clone MultiCraft from `pwd`" + fi cd MultiCraft || customDie "Cannot cd MultiCraft from `pwd`" else cd MultiCraft || customDie "Cannot cd MultiCraft from `pwd`" - git pull || echo "WARNING: Cannot pull MultiCraft from `pwd`" + git pull || dieIfOnline "WARNING: Cannot pull MultiCraft from `pwd`" fi else if [ ! -f "$goodFlagFile" ]; then @@ -34,6 +58,28 @@ else cd MultiCraft || customDie "Cannot cd MultiCraft from `pwd`" fi fi +cd games || customDie "cd games FAILED in `pwd`" +rmdir default +if [ ! -d "default" ]; then + if [ "@$OFFLINE" = "@false" ]; then + git clone https://github.com/MultiCraft/MultiCraft_game default || customDie "Cannot " + else + echo + echo + echo + echo "ERROR: default is not in `pwd`--worlds cannot load without a game." + echo + echo + sleep 2 + fi +else + if [ "@$OFFLINE" = "@false" ]; then + cd default || customDie "cd default FAILED in `pwd`" + git pull || customDie "git pull FAILED in `pwd`" + cd .. || customDie "cd .. FAILED in `pwd`" + fi +fi +cd .. || customDie "cd .. FAILED in `pwd`" srcPath=. flag1="-DOpenGL_GL_PREFERENCE=GLVND" echo @@ -47,4 +93,7 @@ if [ -f "`pwd`/bin/MultiCraft" ]; then else echo "`pwd`" fi +if [ -d "$GIT_USER_DIR/MultiCraft-poikilos" ]; then + rsync -rt --info=progress2 --exclude 'multicraft.conf' "$GIT_USER_DIR/MultiCraft/" "$GIT_USER_DIR/MultiCraft-poikilos" +fi echo "Done."