Browse Source

Change an indent and a function name.

master
poikilos 5 years ago
parent
commit
5f923e2396
  1. 120
      minetestenv.rc

120
minetestenv.rc

@ -1,7 +1,7 @@
err_txt=$HOME/err-enliven.txt err_txt=$HOME/err-enliven.txt
echo "# * minetestenv.rc started `date`" > "$err_txt" echo "# * minetestenv.rc started `date`" > "$err_txt"
customDie() { customExit() {
echo echo
errorLevel=1 errorLevel=1
if [ -z "$2" ]; then if [ -z "$2" ]; then
@ -147,7 +147,7 @@ show_changes="true"
if [ "$SCRIPT" = "/bin/bash" ]; then if [ "$SCRIPT" = "/bin/bash" ]; then
SCRIPT=minetestenv.rc SCRIPT=minetestenv.rc
if [ ! -f "$SCRIPT" ]; then if [ ! -f "$SCRIPT" ]; then
customDie "ERROR: could not find self (need location of self in order to get SCRIPTPATH and then REPO_PATH in order for patches directory to be found." customExit "ERROR: could not find self (need location of self in order to get SCRIPTPATH and then REPO_PATH in order for patches directory to be found."
fi fi
fi fi
# Absolute path this script is in, thus /home/user/bin # Absolute path this script is in, thus /home/user/bin
@ -182,7 +182,7 @@ fi
if [ ! -d "$PATCHES_PATH" ]; then if [ ! -d "$PATCHES_PATH" ]; then
echo echo
echo echo
customDie "ERROR: could not find patches such as in $PATCHES_PATH" customExit "ERROR: could not find patches such as in $PATCHES_PATH"
fi fi
# NOTE: minetest mods (other than 0.4.16 client-side mods) are ALWAYS ONLY installed on server, unless you need them for singleplayer # NOTE: minetest mods (other than 0.4.16 client-side mods) are ALWAYS ONLY installed on server, unless you need them for singleplayer
USR_SHARE_MINETEST=/usr/share/games/minetest USR_SHARE_MINETEST=/usr/share/games/minetest
@ -311,7 +311,7 @@ else
#fi #fi
fi fi
if [ ! -d "$MT_WORLDS_DIR/$MT_MYWORLD_NAME" ]; then if [ ! -d "$MT_WORLDS_DIR/$MT_MYWORLD_NAME" ]; then
customDie " ERROR: failed to find world path, so cannot continue." customExit " ERROR: failed to find world path, so cannot continue."
fi fi
MT_MYWORLD_DIR=$MT_WORLDS_DIR/$MT_MYWORLD_NAME MT_MYWORLD_DIR=$MT_WORLDS_DIR/$MT_MYWORLD_NAME
echo "Using world at $MT_MYWORLD_DIR" echo "Using world at $MT_MYWORLD_DIR"
@ -335,7 +335,7 @@ reinstall_mt_game() {
if [ -d "$USR_SHARE_MINETEST/games/minetest_game" ]; then if [ -d "$USR_SHARE_MINETEST/games/minetest_game" ]; then
echo "successfully recreated $USR_SHARE_MINETEST/games/minetest_game" echo "successfully recreated $USR_SHARE_MINETEST/games/minetest_game"
else else
customDie "failed to create $USR_SHARE_MINETEST/games/minetest_game, so cannot continue." customExit "failed to create $USR_SHARE_MINETEST/games/minetest_game, so cannot continue."
fi fi
else else
echo "ERROR: refusing to reinstall minetest_game since missing sources (not at $HOME/minetest/games/minetest_game nor $HOME/Downloads/minetest/games/minetest_game" echo "ERROR: refusing to reinstall minetest_game since missing sources (not at $HOME/minetest/games/minetest_game nor $HOME/Downloads/minetest/games/minetest_game"
@ -406,74 +406,74 @@ add_mod_from_here()
echo "$MTMOD_DEST_NAME" >> "$MOD_LIST" echo "$MTMOD_DEST_NAME" >> "$MOD_LIST"
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
if [ -z "$MTMOD_DEST_NAME" ]; then if [ -z "$MTMOD_DEST_NAME" ]; then
customDie "ERROR: nothing done since add_mod_from_here FAILED to receive 'MTMOD_DEST_NAME' (1st param)" customExit "ERROR: nothing done since add_mod_from_here FAILED to receive 'MTMOD_DEST_NAME' (1st param)"
fi fi
if [ -z "$MTMOD_GOT_NAME" ]; then if [ -z "$MTMOD_GOT_NAME" ]; then
customDie "ERROR: nothing done since add_mod_from_here FAILED to receive 'MTMOD_GOT_NAME' which is the exact downloaded or unzipped folder name (2nd param)" customExit "ERROR: nothing done since add_mod_from_here FAILED to receive 'MTMOD_GOT_NAME' which is the exact downloaded or unzipped folder name (2nd param)"
fi fi
if [ ! -d "$MTMOD_DEST_PATH" ] || [ "$update_enable" = "true" ]; then if [ ! -d "$MTMOD_DEST_PATH" ] || [ "$update_enable" = "true" ]; then
if [ ! -d "$MTMOD_GOT_NAME" ]; then if [ ! -d "$MTMOD_GOT_NAME" ]; then
customDie "ERROR: nothing done since add_mod_from_here FAILED to find '$MTMOD_GOT_NAME'" customExit "ERROR: nothing done since add_mod_from_here FAILED to find '$MTMOD_GOT_NAME'"
fi fi
if [ -d "$MTMOD_DEST_PATH" ]; then if [ -d "$MTMOD_DEST_PATH" ]; then
if [ ! -f "`command -v rsync`" ]; then if [ ! -f "`command -v rsync`" ]; then
echo "removing old $MTMOD_DEST_PATH" echo "removing old $MTMOD_DEST_PATH"
rm -Rf "$MTMOD_DEST_PATH" rm -Rf "$MTMOD_DEST_PATH"
if [ -d "$MTMOD_DEST_PATH" ]; then if [ -d "$MTMOD_DEST_PATH" ]; then
customDie "FAILED to remove '$MTMOD_DEST_PATH'" customExit "FAILED to remove '$MTMOD_DEST_PATH'"
fi
fi fi
fi fi
fi if [ -d "$MTMOD_GOT_NAME" ]; then
if [ -d "$MTMOD_GOT_NAME" ]; then # outer case is for safety in case variable is blank or something
# outer case is for safety in case variable is blank or something if [ ! -f "`command -v rsync`" ]; then
if [ ! -f "`command -v rsync`" ]; then cp -R $MTMOD_GOT_NAME "$MTMOD_DEST_PATH"
cp -R $MTMOD_GOT_NAME "$MTMOD_DEST_PATH" if [ "$show_changes" != "false" ]; then
if [ "$show_changes" != "false" ]; then echo "$MTMOD_DEST_PATH"
echo "$MTMOD_DEST_PATH" fi
else
if [ ! -d "$MTMOD_DEST_PATH" ]; then
mkdir -p "$MTMOD_DEST_PATH"
fi
if [ "$show_changes" != "false" ]; then
# rsync -rtv "$MTMOD_GOT_NAME/" "$MTMOD_DEST_PATH"
echo " * preview of changes (before actual sync):"
rsync -zvc "$MTMOD_GOT_NAME/" "$MTMOD_DEST_PATH" --dry-run | grep -v '\.git' | grep -v '\./' | grep -v 'screenshot\.png' | grep -v received | grep -v 'DRY RUN'
fi
echo " * synchronizing..."
rsync -rt "$MTMOD_GOT_NAME/" "$MTMOD_DEST_PATH"
fi fi
else if [ -d "$MTMOD_DEST_PATH/.git" ]; then
if [ ! -d "$MTMOD_DEST_PATH" ]; then rm -Rf "$MTMOD_DEST_PATH/.git"
mkdir -p "$MTMOD_DEST_PATH"
fi fi
if [ "$show_changes" != "false" ]; then if [ -f "$MTMOD_DEST_PATH/.gitignore" ]; then
#rsync -rtv "$MTMOD_GOT_NAME/" "$MTMOD_DEST_PATH" rm -Rf "$MTMOD_DEST_PATH/.gitignore"
echo " * preview of changes (before actual sync):"
rsync -zvc "$MTMOD_GOT_NAME/" "$MTMOD_DEST_PATH" --dry-run | grep -v '\.git' | grep -v '\./' | grep -v 'screenshot\.png' | grep -v received | grep -v 'DRY RUN'
fi fi
echo " * synchronizing..." # remove etc to make users downloading mods faster:
rsync -rt "$MTMOD_GOT_NAME/" "$MTMOD_DEST_PATH" if [ -d "$MTMOD_DEST_PATH/etc" ]; then
fi rm -Rf "$MTMOD_DEST_PATH/etc"
if [ -d "$MTMOD_DEST_PATH/.git" ]; then fi
rm -Rf "$MTMOD_DEST_PATH/.git" if [ -d "$MTMOD_DEST_PATH/src" ]; then
fi if [ -z "`ls $MTMOD_DEST_PATH/src/*.lua`" ]; then
if [ -f "$MTMOD_DEST_PATH/.gitignore" ]; then rm -Rf "$MTMOD_DEST_PATH/src"
rm -Rf "$MTMOD_DEST_PATH/.gitignore" fi
fi fi
# remove etc to make users downloading mods faster: if [ -f "$MTMOD_DEST_PATH/screenshot.png" ]; then
if [ -d "$MTMOD_DEST_PATH/etc" ]; then rm -f "$MTMOD_DEST_PATH/screenshot.png"
rm -Rf "$MTMOD_DEST_PATH/etc"
fi
if [ -d "$MTMOD_DEST_PATH/src" ]; then
if [ -z "`ls $MTMOD_DEST_PATH/src/*.lua`" ]; then
rm -Rf "$MTMOD_DEST_PATH/src"
fi fi
fi fi
if [ -f "$MTMOD_DEST_PATH/screenshot.png" ]; then if [ ! -d "$MTMOD_DEST_PATH" ]; then
rm -f "$MTMOD_DEST_PATH/screenshot.png" customExit " MTMOD_DEST_PATH $MTMOD_DEST_PATH is not a directory."
else
echo " [ + ] added as $MTMOD_DEST_PATH"
fi fi
fi cd
if [ ! -d "$MTMOD_DEST_PATH" ]; then #if [ -d GitHub/EnlivenMinetest ]; then
customDie " ERROR: failed to get $MTMOD_DEST_PATH, so cannot continue." # cd GitHub/EnlivenMinetest
#fi
else else
echo " [ + ] added as $MTMOD_DEST_PATH" echo " [ ~ ] skipped existing $MTMOD_DEST_PATH"
fi fi
cd
#if [ -d GitHub/EnlivenMinetest ]; then
# cd GitHub/EnlivenMinetest
#fi
else
echo " [ ~ ] skipped existing $MTMOD_DEST_PATH"
fi
} }
remove_mod() remove_mod()

Loading…
Cancel
Save