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
echo "# * minetestenv.rc started `date`" > "$err_txt"
customDie() {
customExit() {
echo
errorLevel=1
if [ -z "$2" ]; then
@ -147,7 +147,7 @@ show_changes="true"
if [ "$SCRIPT" = "/bin/bash" ]; then
SCRIPT=minetestenv.rc
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
# Absolute path this script is in, thus /home/user/bin
@ -182,7 +182,7 @@ fi
if [ ! -d "$PATCHES_PATH" ]; then
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
# 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
@ -311,7 +311,7 @@ else
#fi
fi
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
MT_MYWORLD_DIR=$MT_WORLDS_DIR/$MT_MYWORLD_NAME
echo "Using world at $MT_MYWORLD_DIR"
@ -335,7 +335,7 @@ reinstall_mt_game() {
if [ -d "$USR_SHARE_MINETEST/games/minetest_game" ]; then
echo "successfully recreated $USR_SHARE_MINETEST/games/minetest_game"
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
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"
@ -406,74 +406,74 @@ add_mod_from_here()
echo "$MTMOD_DEST_NAME" >> "$MOD_LIST"
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
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
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
if [ ! -d "$MTMOD_DEST_PATH" ] || [ "$update_enable" = "true" ]; then
if [ ! -d "$MTMOD_GOT_NAME" ]; then
customDie "ERROR: nothing done since add_mod_from_here FAILED to find '$MTMOD_GOT_NAME'"
fi
if [ -d "$MTMOD_DEST_PATH" ]; then
if [ ! -f "`command -v rsync`" ]; then
echo "removing old $MTMOD_DEST_PATH"
rm -Rf "$MTMOD_DEST_PATH"
if [ -d "$MTMOD_DEST_PATH" ]; then
customDie "FAILED to remove '$MTMOD_DEST_PATH'"
if [ ! -d "$MTMOD_DEST_PATH" ] || [ "$update_enable" = "true" ]; then
if [ ! -d "$MTMOD_GOT_NAME" ]; then
customExit "ERROR: nothing done since add_mod_from_here FAILED to find '$MTMOD_GOT_NAME'"
fi
if [ -d "$MTMOD_DEST_PATH" ]; then
if [ ! -f "`command -v rsync`" ]; then
echo "removing old $MTMOD_DEST_PATH"
rm -Rf "$MTMOD_DEST_PATH"
if [ -d "$MTMOD_DEST_PATH" ]; then
customExit "FAILED to remove '$MTMOD_DEST_PATH'"
fi
fi
fi
fi
if [ -d "$MTMOD_GOT_NAME" ]; then
# outer case is for safety in case variable is blank or something
if [ ! -f "`command -v rsync`" ]; then
cp -R $MTMOD_GOT_NAME "$MTMOD_DEST_PATH"
if [ "$show_changes" != "false" ]; then
echo "$MTMOD_DEST_PATH"
if [ -d "$MTMOD_GOT_NAME" ]; then
# outer case is for safety in case variable is blank or something
if [ ! -f "`command -v rsync`" ]; then
cp -R $MTMOD_GOT_NAME "$MTMOD_DEST_PATH"
if [ "$show_changes" != "false" ]; then
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
else
if [ ! -d "$MTMOD_DEST_PATH" ]; then
mkdir -p "$MTMOD_DEST_PATH"
if [ -d "$MTMOD_DEST_PATH/.git" ]; then
rm -Rf "$MTMOD_DEST_PATH/.git"
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'
if [ -f "$MTMOD_DEST_PATH/.gitignore" ]; then
rm -Rf "$MTMOD_DEST_PATH/.gitignore"
fi
echo " * synchronizing..."
rsync -rt "$MTMOD_GOT_NAME/" "$MTMOD_DEST_PATH"
fi
if [ -d "$MTMOD_DEST_PATH/.git" ]; then
rm -Rf "$MTMOD_DEST_PATH/.git"
fi
if [ -f "$MTMOD_DEST_PATH/.gitignore" ]; then
rm -Rf "$MTMOD_DEST_PATH/.gitignore"
fi
# remove etc to make users downloading mods faster:
if [ -d "$MTMOD_DEST_PATH/etc" ]; then
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"
# remove etc to make users downloading mods faster:
if [ -d "$MTMOD_DEST_PATH/etc" ]; then
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
if [ -f "$MTMOD_DEST_PATH/screenshot.png" ]; then
rm -f "$MTMOD_DEST_PATH/screenshot.png"
fi
fi
if [ -f "$MTMOD_DEST_PATH/screenshot.png" ]; then
rm -f "$MTMOD_DEST_PATH/screenshot.png"
if [ ! -d "$MTMOD_DEST_PATH" ]; then
customExit " MTMOD_DEST_PATH $MTMOD_DEST_PATH is not a directory."
else
echo " [ + ] added as $MTMOD_DEST_PATH"
fi
fi
if [ ! -d "$MTMOD_DEST_PATH" ]; then
customDie " ERROR: failed to get $MTMOD_DEST_PATH, so cannot continue."
cd
#if [ -d GitHub/EnlivenMinetest ]; then
# cd GitHub/EnlivenMinetest
#fi
else
echo " [ + ] added as $MTMOD_DEST_PATH"
echo " [ ~ ] skipped existing $MTMOD_DEST_PATH"
fi
cd
#if [ -d GitHub/EnlivenMinetest ]; then
# cd GitHub/EnlivenMinetest
#fi
else
echo " [ ~ ] skipped existing $MTMOD_DEST_PATH"
fi
}
remove_mod()

Loading…
Cancel
Save