/assets/blender/mbb/

="hl str">"$@" 1>&2 ; exit 1; } prompt_for_number() { local prompt_text=$1 local default_value=$2 local tmp="" while true; do read -p "$prompt_text [$default_value]: " tmp if [ "$tmp" = "" ]; then echo "$default_value"; return elif echo "$tmp" | grep -q -E '^[0-9]+$'; then echo "$tmp"; return fi done } ################################## # Switch to top minetest directory ################################## cd ${0%/*}/.. ####################### # Determine old version ####################### # Make sure all the files we need exist grep -q -E '^set\(VERSION_MAJOR [0-9]+\)$' CMakeLists.txt || die "error: Could not find CMakeLists.txt" grep -q -E '^set\(VERSION_MINOR [0-9]+\)$' CMakeLists.txt || die "error: Could not find CMakeLists.txt" grep -q -E '^set\(VERSION_PATCH [0-9]+\)$' CMakeLists.txt || die "error: Could not find CMakeLists.txt" grep -q -E '^ANDROID_VERSION_CODE = [0-9]+$' build/android/Makefile || die "error: Could not find build/android/Makefile" VERSION_MAJOR=$(grep -E '^set\(VERSION_MAJOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9) VERSION_MINOR=$(grep -E '^set\(VERSION_MINOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9) VERSION_PATCH=$(grep -E '^set\(VERSION_PATCH [0-9]+\)$' CMakeLists.txt | tr -dC 0-9) ANDROID_VERSION_CODE=$(grep -E '^ANDROID_VERSION_CODE = [0-9]+$' build/android/Makefile | tr -dC 0-9) echo "Current Minetest version: $VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH" echo "Current Android version code: $ANDROID_VERSION_CODE" ######################## # Prompt for new version ######################## NEW_VERSION_MAJOR=$VERSION_MAJOR NEW_VERSION_MINOR=$VERSION_MINOR NEW_VERSION_PATCH=$(expr $VERSION_PATCH + 1) NEW_VERSION_MAJOR=$(prompt_for_number "Set major" $NEW_VERSION_MAJOR) if [ "$NEW_VERSION_MAJOR" != "$VERSION_MAJOR" ]; then NEW_VERSION_MINOR=0