diff --git a/Makefile b/Makefile index f56b2c43..a14f0bf1 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ update-submodule: install: SHELL:=/bin/bash install: - git submodule update --init --recursive + source ./gw_util.sh && init_submodule_if_empty docker run --rm -v `pwd`/godwoken-examples:/app -w=/app nervos/godwoken-prebuilds:v0.2.1 yarn # if manual build web3 if [ "$(MANUAL_BUILD_WEB3)" = true ] ; then \ diff --git a/gw_util.sh b/gw_util.sh index 57497116..73cb10d2 100755 --- a/gw_util.sh +++ b/gw_util.sh @@ -223,3 +223,11 @@ update_godwoken_dockerfile_to_manual_mode(){ File="docker/layer2/Dockerfile" sed -i 's/FROM .*/FROM retricsu\/godwoken-manual-build:latest/' $File } + +init_submodule_if_empty(){ + # if submodule folder is empty and not initialized + if [[ -z "$(ls -A godwoken)" || -z "$(ls -A godwoken-examples)" || -z "$(ls -A godwoken-polyjuice)" || -z "$(ls -A godwoken-web3)" || -z "$(ls -A godwoken-scripts)" ]]; then + echo "one or more of submodule folders is Empty, do init and update first." + git submodule update --init --recursive + fi +}