From 6612b16083c70b6c29823dc2d5eaf97eb262c5c8 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Tue, 26 May 2020 14:34:05 -0400 Subject: [PATCH] Separate warnings from errors to allow installing to complete reliably. --- minetestenv-in-place.rc | 8 ++++++-- update-minetest-linux64.sh | 29 +++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/minetestenv-in-place.rc b/minetestenv-in-place.rc index d77a3de..f06b7d9 100644 --- a/minetestenv-in-place.rc +++ b/minetestenv-in-place.rc @@ -326,6 +326,8 @@ deleteIfExists(){ fi } + + installOrUpgradeMinetest(){ # You must set the following variables or sequential parameters: # 1. NEW_VERSION_PATH @@ -397,7 +399,8 @@ installOrUpgradeMinetest(){ fi if [ -d "$VERSIONED_MT_PATH" ]; then - customExit "You already have an old copy of \"$VERSIONED_MT_PATH\". You must rename it or backup your world and other data then remove it before proceeding." + echo "You already have an old copy of \"$VERSIONED_MT_PATH\". You must rename it if you want to reinstall without losing any extra files you may have put there before upgrading to the current version." + return 2 fi if [ ! -f "`command -v basename`" ]; then customExit "Install cannot continue because the basename command is not present." @@ -740,7 +743,8 @@ installOrUpgradeENLIVEN() { customExit "[installOrUpgradeENLIVEN] The REPO_PATH is not set." fi if [ ! -d "$REPO_PATH" ]; then - customExit "[installOrUpgradeENLIVEN] The REPO_PATH does not exist: \"$REPO_PATH\"" + echo " * INFO: [installOrUpgradeENLIVEN] Installing ENLIVEN to games will be skipped since you are not using \"$REPO_PATH\"" + return 2 fi if [ ! -z "$1" ]; then install_dest="$1" diff --git a/update-minetest-linux64.sh b/update-minetest-linux64.sh index e78d92b..37eecf8 100755 --- a/update-minetest-linux64.sh +++ b/update-minetest-linux64.sh @@ -20,9 +20,14 @@ TRY_MT_BASH_RC_PATH="$TRY_CURRENT_MT_SCRIPTS_DIR/$MT_BASH_RC_NAME" if [ -f "$TRY_MT_BASH_RC_PATH" ]; then CURRENT_MT_SCRIPTS_DIR="$TRY_CURRENT_MT_SCRIPTS_DIR" MT_BASH_RC_PATH="$TRY_MT_BASH_RC_PATH" -#fi +fi #if [ ! -f "$MT_BASH_RC_PATH" ]; then -else +if [ ! -d "$REPO_PATH" ]; then + if [ -f "$MT_BASH_RC_PATH" ]; then + echo "* updating \"$MT_BASH_RC_PATH\"..." + rm $MT_BASH_RC_PATH + fi + # ^ Always upgrade the rc file manually if it is not in the repo. if [ ! -d "$CURRENT_MT_SCRIPTS_DIR" ]; then mkdir -p "$CURRENT_MT_SCRIPTS_DIR" fi @@ -157,7 +162,9 @@ if [ "@$old_release_version" = "@$new_release_version" ]; then #show_os_release echo echo - echo "Version $new_release_version is already installed at $INSTALL_PATH. There is nothing to do." + echo "* Adding the icon is complete. See the Desktop or applications (under Games usually--otherwise, search for Final Minetest in the Activities menu if in GNOME or GNOME-based Ubuntu versions 18.04 or later and you do not have a desktop icons extension enabled)." + echo + echo "Version $new_release_version is already installed at $INSTALL_PATH. There is nothing more to do." echo exit 0 fi @@ -181,9 +188,23 @@ unzip "$DL_PATH" > /dev/null || customExit "Extracting $DL_PATH failed." UNUSED_MT_PATH="$INSTALL_PATH.$old_release_version" installOrUpgradeMinetest "$EXTRACTED_PATH" "$INSTALL_PATH" "$UNUSED_MT_PATH" -echo "Installing Final Minetest $new_release_version to $INSTALL_PATH is complete." +if [ $? -eq 2 ]; then + echo "Final Minetest wasn't upgraded. See the message above." +elif [ $? -eq 0 ]; then + echo "Installing Final Minetest $new_release_version to $INSTALL_PATH is complete." +else + echo "(installOrUpgradeMinetest failed with error code $?)" +fi echo " - old:$old_release_version; new:$new_release_version" echo "* installing ENLIVEN..." installOrUpgradeENLIVEN "$INSTALL_PATH" +if [ $? -eq 2 ]; then + echo " * skipped" +elif [ $? -eq 0 ]; then + echo " * Installing ENLIVEN to $INSTALL_PATH/games is complete." +else + echo "(installOrUpgradeMinetest failed with error code $?)" +fi + install_mt_in_place_shortcut "$SHORTCUT_PATH" "$INSTALL_PATH" echo