reorganized files, improved minetest installers
parent
b0b1d4b83b
commit
7fb1b2c2c0
23
README.md
23
README.md
|
@ -123,6 +123,26 @@ Otherwise just install everything EXCEPT cme_to_spawners & tsm_pyramids_to_spawn
|
|||
* The included minetest.conf recommended for your clients includes the line enable_local_map_saving = true, which will cache the world locally on their machines. You can feel free to change that according to your preference.
|
||||
|
||||
## Changes:
|
||||
### (2018-05-10)
|
||||
* moved fully working scripts from etc to root of repo
|
||||
* renamed:
|
||||
```bash
|
||||
mv game-install-ENLIVEN install-ENLIVEN.sh
|
||||
mv game-install-ENLIVEN-testing.sh patch-ENLIVEN-testing.sh #(formerly game-install-enliven-testing.sh)
|
||||
mv minetestserver-install-git-all-backends.sh install-minetestserver-git-all-backends.sh
|
||||
mv minetestserver-uninstall-git-leftovers.sh uninstall-minetestserver-git-leftovers.sh
|
||||
mv minetestserver-uninstall-git.sh uninstall-minetestserver-git.sh
|
||||
mv minetestserver-update-from-git.sh update-minetestserver-git.sh
|
||||
mv noscreen noscreen-startweb.sh
|
||||
mv startweb startweb.sh
|
||||
mv stop-mts stop-mts.sh
|
||||
mv archive-mts-debug archive-minetest-debug.sh
|
||||
mv chat-history-mts chat-history-minetest.sh
|
||||
mv du-show-big du-show-big.sh
|
||||
mv mounter mounter.sh
|
||||
mv unmounter unmounter.sh
|
||||
```
|
||||
* replaced uninstall-minetestserver-git.sh with uninstall-minetestserver-git.py (the shell script version was functionally identical to uninstall-minetestserver-git-leftovers.sh)
|
||||
### (2018-03-13)
|
||||
* added mapfix mod since dynamic_liquid makes one block create a whole pond if set high above ground
|
||||
* removed mapfix due to [improvements to minetest](https://github.com/minetest/minetest/issues/2767)
|
||||
|
@ -332,7 +352,8 @@ squirrel --releasify .\ENLIVEN.<version>.nupkg <your code signing options here>
|
|||
* (minetestoffline.py) (status:closed reason:no solution) assumes name specified in file is same as id (filename)
|
||||
|
||||
### Known issues in mods:
|
||||
* Mining Drill mk3 duplication bug
|
||||
* Crafting wool with dark green dye makes green wool (should make dark green), therefore making pool table is impossible.
|
||||
see https://github.com/minetest/minetest_game/issues/1940
|
||||
* Technic manual is not complete. Contribute info on drills and mining? See https://github.com/minetest-mods/technic/blob/master/manual.md
|
||||
* regular doors and chests are not protected via protection block/symbol
|
||||
* homedecor doors are not protected via protection block/symbol
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
cat $HOME/.minetest/debug.txt | grep CHAT
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
grep $HOME/.minetest/debug.txt | grep CHAT
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ ! -f "install_manifest.txt" ]; then
|
||||
echo "missing install_manifest.txt, cannot uninstall unless you properly run cmake source and are running this script from the base repo directory"
|
||||
exit 1
|
||||
fi
|
||||
sudo xargs rm < install_manifest.txt
|
||||
echo "Remove botched folders from faulty make install path apparently caused by running sudo make install without -DRUN_IN_PLACE=FALSE"
|
||||
echo "This should be safe since only removes directories if empty (except removes /usr/local/mods recursively)..."
|
||||
rmdir /usr/local/mods
|
||||
rmdir /usr/local/textures
|
||||
rmdir /usr/local/games
|
||||
rmdir /usr/local/fonts
|
||||
rmdir /usr/local/builtin
|
||||
rmdir /usr/local/doc
|
||||
rmdir /usr/local/unix
|
||||
rmdir /usr/local/fonts
|
||||
sudo rm -Rf /usr/local/mods
|
||||
sudo rmdir /usr/local/textures
|
||||
sudo rmdir /usr/local/doc
|
||||
sudo rmdir /usr/local/fonts
|
||||
sudo rmdir /usr/local/unix/*
|
||||
#rmdir: failed to remove 'icons': Directory not empty
|
||||
#rmdir: failed to remove 'man': Directory not empty
|
||||
sudo rmdir /usr/local/unix/man/man6
|
||||
sudo rmdir /usr/local/unix/man
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/128x128/*
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/128x128
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/scalable/*
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/scalable
|
||||
sudo rmdir /usr/local/unix/icons/hicolor
|
||||
sudo rmdir /usr/local/unix/icons
|
||||
sudo rmdir /usr/local/unix
|
||||
sudo rmdir /usr/local/builtin/*
|
||||
sudo rmdir /usr/local/builtin
|
|
@ -1,46 +0,0 @@
|
|||
|
||||
LOCAL_REPO_DIR=$HOME/Downloads/minetest
|
||||
if [ ! -f "$LOCAL_REPO_DIR/install_manifest.txt" ]; then
|
||||
echo "missing $LOCAL_REPO_DIR/install_manifest.txt, cannot uninstall unless you properly run cmake source and are running this script from the base repo directory (only runs from that specific location specified for safety)"
|
||||
exit 1
|
||||
fi
|
||||
cd "$LOCAL_REPO_DIR"
|
||||
sudo xargs rm < install_manifest.txt
|
||||
echo "Remove botched folders from faulty make install path apparently caused by running sudo make install without -DRUN_IN_PLACE=FALSE"
|
||||
echo "This should be safe since only removes directories if empty (except removes /usr/local/mods recursively)..."
|
||||
rmdir /usr/local/mods
|
||||
rmdir /usr/local/textures
|
||||
rmdir /usr/local/games
|
||||
rmdir /usr/local/fonts
|
||||
rmdir /usr/local/builtin
|
||||
rmdir /usr/local/doc
|
||||
rmdir /usr/local/unix
|
||||
rmdir /usr/local/fonts
|
||||
sudo rm -Rf /usr/local/mods
|
||||
sudo rm -Rf /usr/local/games/minimal
|
||||
sudo rm -Rf /usr/local/games/minetest_game
|
||||
sudo rmdir /usr/local/textures
|
||||
sudo rmdir /usr/local/doc
|
||||
sudo rmdir /usr/local/fonts
|
||||
sudo rmdir /usr/local/unix/*
|
||||
#rmdir: failed to remove 'icons': Directory not empty
|
||||
#rmdir: failed to remove 'man': Directory not empty
|
||||
sudo rmdir /usr/local/unix/man/man6
|
||||
sudo rmdir /usr/local/unix/man
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/128x128/*
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/128x128
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/scalable/*
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/scalable
|
||||
sudo rmdir /usr/local/unix/icons/hicolor
|
||||
sudo rmdir /usr/local/unix/icons
|
||||
sudo rmdir /usr/local/unix
|
||||
sudo rmdir /usr/local/builtin/*
|
||||
sudo rmdir /usr/local/builtin
|
||||
if [ -f "`command -v update-desktop-database`" ]; then
|
||||
echo "updating desktop database as per https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=minetest-git"
|
||||
update-desktop-database &>/dev/null && update-desktop-database -q
|
||||
fi
|
||||
if [ -f "`command -v gtk-update-icon-cache`" ]; then
|
||||
echo "updating gtk icon cache as per https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=minetest-git"
|
||||
gtk-update-icon-cache &>/dev/null && gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
|
||||
fi
|
|
@ -33,432 +33,21 @@ sudo echo "starting ENLIVEN installer script..."
|
|||
## this space was intentionally left blank
|
||||
|
||||
|
||||
|
||||
#region paste this part into terminal to get some great environment variables
|
||||
CONFIGS_PATH="$HOME/.config/EnlivenMinetest"
|
||||
if [ ! -d "$CONFIGS_PATH" ]; then
|
||||
mkdir -p "$CONFIGS_PATH"
|
||||
if [ ! -f minetestenv.rc ]; then
|
||||
if [ -f "$HOME/GitHub/EnlivenMinetest" ]; then
|
||||
cd "$HOME/GitHub/EnlivenMinetest"
|
||||
elif [ -f "$HOME/git/EnlivenMinetest" ]; then
|
||||
cd "$HOME/git/EnlivenMinetest"
|
||||
elif [ -f "$HOME/Documents/GitHub/EnlivenMinetest" ]; then
|
||||
cd "$HOME/Documents/GitHub/EnlivenMinetest"
|
||||
fi
|
||||
fi
|
||||
# * Git version uses /home/*/minetest/games and /usr/local/share/minetest/games but the latter is used for minetestserver (minetest-server package)
|
||||
# * Arch stable version uses /usr/share/minetest/
|
||||
if [ "$1" = "--help" ]; then
|
||||
echo "This script installs ENLIVEN subgame for minetest. It uses individual git repositories, so please only run this once so as not to exceed their bandwidth."
|
||||
echo "Usage:"
|
||||
echo
|
||||
echo "version_0_5_enable=<value> (where value is true or false): forces 0.5 (if not specified, this script uses 0.5 versions of mods if minetest is at /usr/local/share/minetest)"
|
||||
echo
|
||||
echo "local_enable=<value> (where value is true or false): forces /usr/local/share/minetest (if not specified, script detects minetest but if exists both in /usr/share/ and /usr/local/share, prefers /usr/local/share/minetest)"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
if [ "$1" = "version_0_5_enable=true" ]; then
|
||||
version_0_5_enable="true"
|
||||
elif [ "$2" = "version_0_5_enable=true" ]; then
|
||||
version_0_5_enable="true"
|
||||
elif [ "$1" = "version_0_5_enable=false" ]; then
|
||||
version_0_5_enable="false"
|
||||
elif [ "$2" = "version_0_5_enable=false" ]; then
|
||||
version_0_5_enable="false"
|
||||
fi
|
||||
if [ "$1" = "local_enable=true" ]; then
|
||||
local_enable="true"
|
||||
elif [ "$2" = "local_enable=true" ]; then
|
||||
local_enable="true"
|
||||
elif [ "$1" = "local_enable=false" ]; then
|
||||
local_enable="false"
|
||||
elif [ "$2" = "local_enable=false" ]; then
|
||||
local_enable="false"
|
||||
fi
|
||||
if [ -f "$CONFIGS_PATH/local_enable" ]; then
|
||||
local_enable=$(head -n 1 $CONFIGS_PATH/local_enable)
|
||||
fi
|
||||
if [ -f "$CONFIGS_PATH/version_0_5_enable" ]; then
|
||||
version_0_5_enable=$(head -n 1 $CONFIGS_PATH/version_0_5_enable)
|
||||
fi
|
||||
if [ -z "$local_enable" ]; then
|
||||
echo "$local_enable" > "$CONFIGS_PATH/local_enable"
|
||||
fi
|
||||
if [ -z "$version_0_5_enable" ]; then
|
||||
echo "$version_0_5_enable" > "$CONFIGS_PATH/version_0_5_enable"
|
||||
fi
|
||||
#echo "3..."
|
||||
#sleep 1
|
||||
#echo "2..."
|
||||
#sleep 1
|
||||
#echo "1..."
|
||||
#sleep 1
|
||||
update_enable="true"
|
||||
shell_name="bash"
|
||||
err_txt=$HOME/err-enliven.txt
|
||||
# doesn't work if equal: [ $0 = *"$shell_name"* ]
|
||||
# could be -bash or bash
|
||||
#if [ "$0" = "-bash" ]; then
|
||||
#'[[' doesn't work in debian
|
||||
if [[ $0 == *"$shell_name"* ]]; then
|
||||
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
|
||||
echo "You must have pasted this into terminal, so assuming REPO_PATH:"
|
||||
echo " $REPO_PATH"
|
||||
else
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
# Absolute path this script is in, thus /home/user/bin
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
REPO_PATH=$(dirname "$SCRIPTPATH")
|
||||
fi
|
||||
|
||||
PATCHES_PATH="$REPO_PATH/patches"
|
||||
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
# maybe moved somewhere or this code was pasted
|
||||
PATCHES_PATH=$HOME/GitHub/EnlivenMinetest/patches
|
||||
fi
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
# maybe running from root of repo
|
||||
PATCHES_PATH="patches"
|
||||
fi
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
# should work if ran from folder where exists
|
||||
PATCHES_PATH="../patches"
|
||||
fi
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
echo
|
||||
echo
|
||||
echo "ERROR: could not find patches such as in $PATCHES_PATH"
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
if [ ! -f minetestenv.rc ]; then
|
||||
echo "ERROR: Nothing done since missing minetestenv.rc (must be in same directory)"
|
||||
sleep 1
|
||||
exit 1
|
||||
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
|
||||
try_path="/usr/share/minetest"
|
||||
if [ -d "$try_path" ]; then
|
||||
# Arch linux
|
||||
USR_SHARE_MINETEST="$try_path"
|
||||
fi
|
||||
if [ "$local_enable" != "false" ]; then
|
||||
# IF git version is installed
|
||||
try_path="/usr/local/share/minetest"
|
||||
if [ -d "$try_path" ]; then
|
||||
if [ -z "$version_0_5_enable" ]; then
|
||||
version_0_5_enable="true"
|
||||
fi
|
||||
USR_SHARE_MINETEST="$try_path"
|
||||
fi
|
||||
fi
|
||||
mtgame_name="minetest_game"
|
||||
MT_MINETEST_GAME_PATH=$USR_SHARE_MINETEST/games/$mtgame_name
|
||||
#echo "3..."
|
||||
#sleep 1
|
||||
#echo "2..."
|
||||
#sleep 1
|
||||
#echo "1..."
|
||||
#sleep 1
|
||||
# UNUSED (unknown use): MT_GAMES_DIR=$HOME/.minetest/mods
|
||||
# intentionally skip the slash in the following line since $USR_SHARE_MINETEST already starts with one:
|
||||
MT_BACKUP_GAMES_DIR=$HOME/Backup$USR_SHARE_MINETEST/games
|
||||
MT_GAMES_DIR=$USR_SHARE_MINETEST/games
|
||||
MT_MYGAME_BAK=$USR_SHARE_MINETEST/ENLIVEN_BAK
|
||||
MT_MYGAME_NAME=ENLIVEN
|
||||
MT_MYGAME_DIR="$MT_GAMES_DIR/$MT_MYGAME_NAME"
|
||||
# formerly MT_MYGAME_MODDIR:
|
||||
MT_MYGAME_MODS_PATH="$MT_MYGAME_DIR/mods"
|
||||
MT_WORLDS_DIR="$HOME/.minetest/worlds"
|
||||
MT_DEFAULT_WORLD_NAME="`ls $MT_WORLDS_DIR | grep -v tar.gz | grep --max-count=1 -v world`" # aka -m 1 (no '=' sign in that case)
|
||||
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
|
||||
if [ -z "$MT_DEFAULT_WORLD_NAME" ]; then
|
||||
if [ ! -z "`ls $MT_WORLDS_DIR | grep --max-count=1 -v world`" ]; then
|
||||
MT_MYWORLD_NAME=world
|
||||
echo "Could not find any worlds other than $MT_MYWORLD_NAME"
|
||||
else
|
||||
echo "Could not find any worlds"
|
||||
fi
|
||||
#if [ "$0" = "-bash" ]; then
|
||||
#'[[' doesn't work in debian:
|
||||
if [[ $0 == *"$shell_name"* ]]; then
|
||||
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
|
||||
MT_MYWORLD_NAME="world"
|
||||
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
|
||||
echo " $MT_MYWORLD_NAME"
|
||||
echo "Press Ctrl C to cancel, otherwise $MT_MYWORLD_NAME will be used..."
|
||||
#sleep 1
|
||||
#echo " 3..."
|
||||
#sleep 1
|
||||
#echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
else
|
||||
read -p "Please enter a world (name only--must be in $MT_WORLDS_DIR): " MT_MYWORLD_NAME
|
||||
#$MT_DEFAULT_WORLD_NAME
|
||||
echo using "$MT_MYWORLD_NAME"
|
||||
#echo " 3..."
|
||||
#sleep 1
|
||||
#echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
fi
|
||||
else
|
||||
#'[[' doesn't work in debian:
|
||||
if [[ $0 == *"$shell_name"* ]]; then
|
||||
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
|
||||
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
|
||||
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
|
||||
echo " $MT_MYWORLD_NAME"
|
||||
else
|
||||
ls $MT_WORLDS_DIR
|
||||
read -p "Please enter a world [blank for $MT_DEFAULT_WORLD_NAME]: " MT_MYWORLD_NAME
|
||||
#$MT_DEFAULT_WORLD_NAME
|
||||
if [ -z "$MT_MYWORLD_NAME" ]; then
|
||||
MT_MYWORLD_NAME=$MT_DEFAULT_WORLD_NAME
|
||||
fi
|
||||
echo using "$MT_MYWORLD_NAME"
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
if [ -z "$MT_MYWORLD_NAME" ]; then
|
||||
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$MT_WORLDS_DIR/$MT_MYWORLD_NAME" ]; then
|
||||
echo " ERROR: failed to find world path, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
fi
|
||||
MT_MYWORLD_DIR=$MT_WORLDS_DIR/$MT_MYWORLD_NAME
|
||||
echo "Using world at $MT_MYWORLD_DIR"
|
||||
WORLD_MT_PATH=$MT_MYWORLD_DIR/world.mt
|
||||
# see also https://www.shellscript.sh/functions.html
|
||||
|
||||
reinstall_mt_game() {
|
||||
if [ "$MT_MINETEST_GAME_PATH" = "/usr/local/share/minetest/games/minetest_game" ]; then
|
||||
SRC_MT="$HOME/minetest"
|
||||
if [ -d "$HOME/Downloads/minetest/games/minetest_game" ]; then
|
||||
SRC_MT="$HOME/Downloads/minetest"
|
||||
fi
|
||||
if [ -d "$SRC_MT" ]; then
|
||||
SRC_MT_GAME="$SRC_MT/games/minetest_game"
|
||||
cd $SRC_MT_GAME
|
||||
echo "updating $SRC_MT_GAME..."
|
||||
git pull
|
||||
cd
|
||||
sudo rm -Rf "$MT_MINETEST_GAME_PATH"
|
||||
sudo cp -R "$SRC_MT_GAME" "$USR_SHARE_MINETEST/games/"
|
||||
if [ -d "$USR_SHARE_MINETEST/games/minetest_game" ]; then
|
||||
echo "successfully recreated $USR_SHARE_MINETEST/games/minetest_game"
|
||||
else
|
||||
echo " ERROR: failed to create $USR_SHARE_MINETEST/games/minetest_game, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
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"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: refusing to reinstall minetest_game to packaged dir: $MT_MINETEST_GAME_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
add_zip_mod()
|
||||
{
|
||||
cd $HOME/Downloads
|
||||
MTMOD_DEST_NAME=$1
|
||||
MTMOD_UNZ_NAME=$2
|
||||
URL=$3
|
||||
MTMOD_SRC_ZIP=$MTMOD_DEST_NAME.zip
|
||||
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
|
||||
if [ ! -z "`ls | grep $MTMOD_UNZ_NAME`" ]; then # works with wildcard in variable
|
||||
rm -Rf $MTMOD_UNZ_NAME
|
||||
fi
|
||||
if [ -f $MTMOD_SRC_ZIP ]; then
|
||||
rm -f $MTMOD_SRC_ZIP
|
||||
fi
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
sudo rm -Rf "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
wget -O $MTMOD_SRC_ZIP $URL
|
||||
unzip -q "$MTMOD_SRC_ZIP"
|
||||
#-q: quiet
|
||||
if [ -d "$MTMOD_UNZ_NAME" ]; then
|
||||
# outer case is for safety in case variable is blank or something
|
||||
if [ -d "$MTMOD_UNZ_NAME/.git" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.git"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/.gitignore" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.gitignore"
|
||||
fi
|
||||
# remove etc to make users downloading mods faster:
|
||||
if [ -d "$MTMOD_UNZ_NAME/etc" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/etc"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/screenshot.png" ]; then
|
||||
rm -f "$MTMOD_UNZ_NAME/screenshot.png"
|
||||
fi
|
||||
sudo mv $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
if [ ! -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo " ERROR: failed to unzip $MTMOD_DEST_PATH, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
else
|
||||
echo " added as $MTMOD_DEST_PATH"
|
||||
fi
|
||||
cd
|
||||
#if [ -d GitHub/EnlivenMinetest ]; then
|
||||
# cd GitHub/EnlivenMinetest
|
||||
#fi
|
||||
}
|
||||
|
||||
add_git_mod()
|
||||
{
|
||||
cd $HOME/Downloads
|
||||
MTMOD_DEST_NAME=$1
|
||||
MTMOD_UNZ_NAME=$2
|
||||
URL=$3
|
||||
BRANCH=$4
|
||||
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
|
||||
if [ ! -d "$MTMOD_DEST_PATH" ] || [ "$update_enable" = "true" ]; then
|
||||
if [ ! -z "`ls | grep $MTMOD_UNZ_NAME`" ]; then # works with wildcard in variable
|
||||
rm -Rf $MTMOD_UNZ_NAME
|
||||
fi
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo "removing old $MTMOD_DEST_PATH"
|
||||
sudo rm -Rf "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
if [ ! -z "$BRANCH" ]; then
|
||||
echo "Cloning $BRANCH branch..."
|
||||
git clone -b $BRANCH --single-branch $URL
|
||||
else
|
||||
echo "Cloning main branch since no branch specified: $BRANCH"
|
||||
git clone $URL
|
||||
fi
|
||||
if [ -d "$MTMOD_UNZ_NAME" ]; then
|
||||
# outer case is for safety in case variable is blank or something
|
||||
if [ -d "$MTMOD_UNZ_NAME/.git" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.git"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/.gitignore" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.gitignore"
|
||||
fi
|
||||
# remove etc to make users downloading mods faster:
|
||||
if [ -d "$MTMOD_UNZ_NAME/etc" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/etc"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/screenshot.png" ]; then
|
||||
rm -f "$MTMOD_UNZ_NAME/screenshot.png"
|
||||
fi
|
||||
sudo mv $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
if [ ! -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo " ERROR: failed to unzip $MTMOD_DEST_PATH, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
else
|
||||
echo " [ + ] added as $MTMOD_DEST_PATH"
|
||||
fi
|
||||
cd
|
||||
#if [ -d GitHub/EnlivenMinetest ]; then
|
||||
# cd GitHub/EnlivenMinetest
|
||||
#fi
|
||||
else
|
||||
echo " [ ~ ] skipped existing $MTMOD_DEST_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
remove_mod()
|
||||
{
|
||||
cd $HOME/Downloads
|
||||
MTMOD_DEST_NAME=$1
|
||||
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
sudo rm -Rf "$MTMOD_DEST_PATH"
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo " ERROR in remove_mod: failed to remove $MTMOD_DEST_PATH, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
else
|
||||
echo " [ - ] removed $MTMOD_DEST_PATH"
|
||||
fi
|
||||
else
|
||||
echo " [ - ] already not present: $MTMOD_DEST_PATH"
|
||||
fi
|
||||
cd
|
||||
#if [ -d GitHub/EnlivenMinetest ]; then
|
||||
# cd GitHub/EnlivenMinetest
|
||||
#fi
|
||||
}
|
||||
#echo "MT_MYGAME_MODS_PATH: $MT_MYGAME_MODS_PATH"
|
||||
echo
|
||||
echo
|
||||
echo "To preconfigure, write true or false to files in $CONFIGS_PATH named:"
|
||||
echo " local_enable"
|
||||
echo " version_0_5_enable"
|
||||
echo
|
||||
echo "Using following configuration:"
|
||||
if [ -z "$version_0_5_enable" ]; then
|
||||
echo " version_0_5_enable: (auto--set this var before pasting region into terminal)"
|
||||
else
|
||||
echo " version_0_5_enable: $version_0_5_enable"
|
||||
fi
|
||||
if [ -z "$local_enable" ]; then
|
||||
echo " local_enable: (auto--set this var before pasting region into terminal)"
|
||||
else
|
||||
echo "local_enable: $local_enable"
|
||||
fi
|
||||
echo " USR_SHARE_MINETEST: $USR_SHARE_MINETEST"
|
||||
echo " MT_MYGAME_DIR: $MT_MYGAME_DIR"
|
||||
echo " MT_WORLDS_DIR: $MT_WORLDS_DIR"
|
||||
echo " MT_MYWORLD_NAME: $MT_MYWORLD_NAME"
|
||||
echo " MT_MINETEST_GAME_PATH: $MT_MINETEST_GAME_PATH"
|
||||
|
||||
#endregion paste this part into terminal to get some great environment variables
|
||||
|
||||
|
|
@ -8,7 +8,9 @@ echo "This script compiles AND installs minetestserver (NOT run-in-place, but ra
|
|||
echo
|
||||
echo
|
||||
echo "If you want to install the client on your server (not normal practice), add client or both param when calling this script."
|
||||
#if [ -f "`command -v minetest`" ]; then
|
||||
echo "Removing the non-git (packaged) version first (Press Ctrl C to cancel)..."
|
||||
#fi
|
||||
sleep 1
|
||||
echo "3..."
|
||||
sleep 1
|
||||
|
@ -57,39 +59,58 @@ if [ ! -d "Downloads" ]; then
|
|||
mkdir Downloads
|
||||
fi
|
||||
cd Downloads
|
||||
if [ -d minetest ]; then
|
||||
echo "ERROR: Nothing done since 'minetest' already exists in `pwd`--delete it before cloning, or run the included update script to update."
|
||||
echo "Ctrl C or this window will exit..."
|
||||
echo "3..."
|
||||
sleep 1
|
||||
echo "2..."
|
||||
sleep 1
|
||||
echo "1..."
|
||||
sleep 1
|
||||
#if [ -d minetest ]; then
|
||||
#echo "ERROR: Nothing done since 'minetest' already exists in `pwd`--delete it before cloning, or run the included update script to update."
|
||||
#echo "Ctrl C or this window will exit..."
|
||||
#echo "3..."
|
||||
#sleep 1
|
||||
#echo "2..."
|
||||
#sleep 1
|
||||
#echo "1..."
|
||||
#sleep 1
|
||||
#cd minetest
|
||||
else
|
||||
#else
|
||||
if [ ! -d minetest ]; then
|
||||
git clone https://github.com/minetest/minetest.git
|
||||
cd minetest
|
||||
else
|
||||
cd minetest
|
||||
echo "updating: `pwd`"
|
||||
git pull # --all # see https://forum.minetest.net/viewtopic.php?f=42&t=3837&start=125#p306449
|
||||
fi
|
||||
#cd minetest
|
||||
git pull --all # see https://forum.minetest.net/viewtopic.php?f=42&t=3837&start=125#p306449
|
||||
cd minetest/games
|
||||
cd games
|
||||
if [ ! -d minetest_game ]; then
|
||||
git clone https://github.com/minetest/minetest_game.git
|
||||
else
|
||||
cd minetest_game
|
||||
git pull --all
|
||||
echo "updating: `pwd`"
|
||||
git pull # --all
|
||||
cd ..
|
||||
fi
|
||||
git pull --all
|
||||
#(does nothing since currently in games folder) git pull --all
|
||||
#echo "in: `pwd`"
|
||||
cd ..
|
||||
#echo "in: `pwd`"
|
||||
#echo "..."
|
||||
#sleep 10
|
||||
# heavily modified from forum url above due to hints from AUR files obtained via git clone https://aur.archlinux.org/minetest-git-leveldb.git
|
||||
echo "ENABLE_CURSES enables server-side terminal via --terminal option"
|
||||
build_what="-DBUILD_SERVER=on -DBUILD_CLIENT=off"
|
||||
if [ "$1" = "both" ]; then
|
||||
build_what="-DBUILD_SERVER=on -DBUILD_CLIENT=on"
|
||||
echo "Building minetest and minetestserver (only)..."
|
||||
elif [ "$1" = "client" ]; then
|
||||
build_what="-DBUILD_SERVER=off -DBUILD_CLIENT=on"
|
||||
echo "Building minetest CLIENT (only)..."
|
||||
else
|
||||
echo "Building minetestserver..."
|
||||
fi
|
||||
echo "3..."
|
||||
sleep 1
|
||||
echo "2..."
|
||||
sleep 1
|
||||
echo "1..."
|
||||
sleep 1
|
||||
cmake . -DENABLE_GETTEXT=on -DENABLE_CURSES=on -DENABLE_FREETYPE=on -DENABLE_LEVELDB=on -DENABLE_CURL=on -DENABLE_GETTEXT=on -DENABLE_REDIS=on -DENABLE_POSTGRESQL=on -DRUN_IN_PLACE=off -DCMAKE_BUILD_TYPE=Release $build_what
|
||||
# NOTE: as long as -DRUN_IN_PLACE=off, above installs correctly without -DCMAKE_INSTALL_PREFIX=/usr which for some reason is used by https://aur.archlinux.org/minetest-git.git
|
||||
# -DCMAKE_BUILD_TYPE=Release as per https://aur.archlinux.org/minetest-git.git
|
|
@ -0,0 +1,424 @@
|
|||
|
||||
CONFIGS_PATH="$HOME/.config/EnlivenMinetest"
|
||||
if [ ! -d "$CONFIGS_PATH" ]; then
|
||||
mkdir -p "$CONFIGS_PATH"
|
||||
fi
|
||||
# * Git version uses /home/*/minetest/games and /usr/local/share/minetest/games but the latter is used for minetestserver (minetest-server package)
|
||||
# * Arch stable version uses /usr/share/minetest/
|
||||
if [ "$1" = "--help" ]; then
|
||||
echo "This script installs ENLIVEN subgame for minetest. It uses individual git repositories, so please only run this once so as not to exceed their bandwidth."
|
||||
echo "Usage:"
|
||||
echo
|
||||
echo "version_0_5_enable=<value> (where value is true or false): forces 0.5 (if not specified, this script uses 0.5 versions of mods if minetest is at /usr/local/share/minetest)"
|
||||
echo
|
||||
echo "local_enable=<value> (where value is true or false): forces /usr/local/share/minetest (if not specified, script detects minetest but if exists both in /usr/share/ and /usr/local/share, prefers /usr/local/share/minetest)"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
if [ "$1" = "version_0_5_enable=true" ]; then
|
||||
version_0_5_enable="true"
|
||||
elif [ "$2" = "version_0_5_enable=true" ]; then
|
||||
version_0_5_enable="true"
|
||||
elif [ "$1" = "version_0_5_enable=false" ]; then
|
||||
version_0_5_enable="false"
|
||||
elif [ "$2" = "version_0_5_enable=false" ]; then
|
||||
version_0_5_enable="false"
|
||||
fi
|
||||
if [ "$1" = "local_enable=true" ]; then
|
||||
local_enable="true"
|
||||
elif [ "$2" = "local_enable=true" ]; then
|
||||
local_enable="true"
|
||||
elif [ "$1" = "local_enable=false" ]; then
|
||||
local_enable="false"
|
||||
elif [ "$2" = "local_enable=false" ]; then
|
||||
local_enable="false"
|
||||
fi
|
||||
if [ -f "$CONFIGS_PATH/local_enable" ]; then
|
||||
local_enable=$(head -n 1 $CONFIGS_PATH/local_enable)
|
||||
fi
|
||||
if [ -f "$CONFIGS_PATH/version_0_5_enable" ]; then
|
||||
version_0_5_enable=$(head -n 1 $CONFIGS_PATH/version_0_5_enable)
|
||||
fi
|
||||
if [ -z "$local_enable" ]; then
|
||||
echo "$local_enable" > "$CONFIGS_PATH/local_enable"
|
||||
fi
|
||||
if [ -z "$version_0_5_enable" ]; then
|
||||
echo "$version_0_5_enable" > "$CONFIGS_PATH/version_0_5_enable"
|
||||
fi
|
||||
#echo "3..."
|
||||
#sleep 1
|
||||
#echo "2..."
|
||||
#sleep 1
|
||||
#echo "1..."
|
||||
#sleep 1
|
||||
update_enable="true"
|
||||
shell_name="bash"
|
||||
err_txt=$HOME/err-enliven.txt
|
||||
# doesn't work if equal: [ $0 = *"$shell_name"* ]
|
||||
# could be -bash or bash
|
||||
#if [ "$0" = "-bash" ]; then
|
||||
#'[[' doesn't work in debian
|
||||
if [[ $0 == *"$shell_name"* ]]; then
|
||||
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
|
||||
echo "You must have pasted this into terminal, so assuming REPO_PATH:"
|
||||
echo " $REPO_PATH"
|
||||
else
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
# Absolute path this script is in, thus /home/user/bin
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
REPO_PATH=$(dirname "$SCRIPTPATH")
|
||||
fi
|
||||
|
||||
PATCHES_PATH="$REPO_PATH/patches"
|
||||
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
# maybe moved somewhere or this code was pasted
|
||||
PATCHES_PATH=$HOME/GitHub/EnlivenMinetest/patches
|
||||
fi
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
# maybe running from root of repo
|
||||
PATCHES_PATH="patches"
|
||||
fi
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
# should work if ran from folder where exists
|
||||
PATCHES_PATH="../patches"
|
||||
fi
|
||||
if [ ! -d "$PATCHES_PATH" ]; then
|
||||
echo
|
||||
echo
|
||||
echo "ERROR: could not find patches such as in $PATCHES_PATH"
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
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
|
||||
try_path="/usr/share/minetest"
|
||||
if [ -d "$try_path" ]; then
|
||||
# Arch linux
|
||||
USR_SHARE_MINETEST="$try_path"
|
||||
fi
|
||||
if [ "$local_enable" != "false" ]; then
|
||||
# IF git version is installed
|
||||
try_path="/usr/local/share/minetest"
|
||||
if [ -d "$try_path" ]; then
|
||||
if [ -z "$version_0_5_enable" ]; then
|
||||
version_0_5_enable="true"
|
||||
fi
|
||||
USR_SHARE_MINETEST="$try_path"
|
||||
fi
|
||||
fi
|
||||
mtgame_name="minetest_game"
|
||||
MT_MINETEST_GAME_PATH=$USR_SHARE_MINETEST/games/$mtgame_name
|
||||
#echo "3..."
|
||||
#sleep 1
|
||||
#echo "2..."
|
||||
#sleep 1
|
||||
#echo "1..."
|
||||
#sleep 1
|
||||
# UNUSED (unknown use): MT_GAMES_DIR=$HOME/.minetest/mods
|
||||
# intentionally skip the slash in the following line since $USR_SHARE_MINETEST already starts with one:
|
||||
MT_BACKUP_GAMES_DIR=$HOME/Backup$USR_SHARE_MINETEST/games
|
||||
MT_GAMES_DIR=$USR_SHARE_MINETEST/games
|
||||
MT_MYGAME_BAK=$USR_SHARE_MINETEST/ENLIVEN_BAK
|
||||
MT_MYGAME_NAME=ENLIVEN
|
||||
MT_MYGAME_DIR="$MT_GAMES_DIR/$MT_MYGAME_NAME"
|
||||
# formerly MT_MYGAME_MODDIR:
|
||||
MT_MYGAME_MODS_PATH="$MT_MYGAME_DIR/mods"
|
||||
MT_WORLDS_DIR="$HOME/.minetest/worlds"
|
||||
MT_DEFAULT_WORLD_NAME="`ls $MT_WORLDS_DIR | grep -v tar.gz | grep --max-count=1 -v world`" # aka -m 1 (no '=' sign in that case)
|
||||
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
|
||||
if [ -z "$MT_DEFAULT_WORLD_NAME" ]; then
|
||||
if [ ! -z "`ls $MT_WORLDS_DIR | grep --max-count=1 -v world`" ]; then
|
||||
MT_MYWORLD_NAME=world
|
||||
echo "Could not find any worlds other than $MT_MYWORLD_NAME"
|
||||
else
|
||||
echo "Could not find any worlds"
|
||||
fi
|
||||
#if [ "$0" = "-bash" ]; then
|
||||
#'[[' doesn't work in debian:
|
||||
if [[ $0 == *"$shell_name"* ]]; then
|
||||
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
|
||||
MT_MYWORLD_NAME="world"
|
||||
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
|
||||
echo " $MT_MYWORLD_NAME"
|
||||
echo "Press Ctrl C to cancel, otherwise $MT_MYWORLD_NAME will be used..."
|
||||
#sleep 1
|
||||
#echo " 3..."
|
||||
#sleep 1
|
||||
#echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
else
|
||||
read -p "Please enter a world (name only--must be in $MT_WORLDS_DIR): " MT_MYWORLD_NAME
|
||||
#$MT_DEFAULT_WORLD_NAME
|
||||
echo using "$MT_MYWORLD_NAME"
|
||||
#echo " 3..."
|
||||
#sleep 1
|
||||
#echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
fi
|
||||
else
|
||||
#'[[' doesn't work in debian:
|
||||
if [[ $0 == *"$shell_name"* ]]; then
|
||||
REPO_PATH="$HOME/GitHub/EnlivenMinetest"
|
||||
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
|
||||
echo "You must have pasted this into terminal, so assuming MT_MYWORLD_NAME:"
|
||||
echo " $MT_MYWORLD_NAME"
|
||||
else
|
||||
ls $MT_WORLDS_DIR
|
||||
read -p "Please enter a world [blank for $MT_DEFAULT_WORLD_NAME]: " MT_MYWORLD_NAME
|
||||
#$MT_DEFAULT_WORLD_NAME
|
||||
if [ -z "$MT_MYWORLD_NAME" ]; then
|
||||
MT_MYWORLD_NAME=$MT_DEFAULT_WORLD_NAME
|
||||
fi
|
||||
echo using "$MT_MYWORLD_NAME"
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
if [ -z "$MT_MYWORLD_NAME" ]; then
|
||||
MT_MYWORLD_NAME="$MT_DEFAULT_WORLD_NAME"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$MT_WORLDS_DIR/$MT_MYWORLD_NAME" ]; then
|
||||
echo " ERROR: failed to find world path, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
fi
|
||||
MT_MYWORLD_DIR=$MT_WORLDS_DIR/$MT_MYWORLD_NAME
|
||||
echo "Using world at $MT_MYWORLD_DIR"
|
||||
WORLD_MT_PATH=$MT_MYWORLD_DIR/world.mt
|
||||
# see also https://www.shellscript.sh/functions.html
|
||||
|
||||
reinstall_mt_game() {
|
||||
if [ "$MT_MINETEST_GAME_PATH" = "/usr/local/share/minetest/games/minetest_game" ]; then
|
||||
SRC_MT="$HOME/minetest"
|
||||
if [ -d "$HOME/Downloads/minetest/games/minetest_game" ]; then
|
||||
SRC_MT="$HOME/Downloads/minetest"
|
||||
fi
|
||||
if [ -d "$SRC_MT" ]; then
|
||||
SRC_MT_GAME="$SRC_MT/games/minetest_game"
|
||||
cd $SRC_MT_GAME
|
||||
echo "updating $SRC_MT_GAME..."
|
||||
git pull
|
||||
cd
|
||||
sudo rm -Rf "$MT_MINETEST_GAME_PATH"
|
||||
sudo cp -R "$SRC_MT_GAME" "$USR_SHARE_MINETEST/games/"
|
||||
if [ -d "$USR_SHARE_MINETEST/games/minetest_game" ]; then
|
||||
echo "successfully recreated $USR_SHARE_MINETEST/games/minetest_game"
|
||||
else
|
||||
echo " ERROR: failed to create $USR_SHARE_MINETEST/games/minetest_game, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
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"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: refusing to reinstall minetest_game to packaged dir: $MT_MINETEST_GAME_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
add_zip_mod()
|
||||
{
|
||||
cd $HOME/Downloads
|
||||
MTMOD_DEST_NAME=$1
|
||||
MTMOD_UNZ_NAME=$2
|
||||
URL=$3
|
||||
MTMOD_SRC_ZIP=$MTMOD_DEST_NAME.zip
|
||||
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
|
||||
if [ ! -z "`ls | grep $MTMOD_UNZ_NAME`" ]; then # works with wildcard in variable
|
||||
rm -Rf $MTMOD_UNZ_NAME
|
||||
fi
|
||||
if [ -f $MTMOD_SRC_ZIP ]; then
|
||||
rm -f $MTMOD_SRC_ZIP
|
||||
fi
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
sudo rm -Rf "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
wget -O $MTMOD_SRC_ZIP $URL
|
||||
unzip -q "$MTMOD_SRC_ZIP"
|
||||
#-q: quiet
|
||||
if [ -d "$MTMOD_UNZ_NAME" ]; then
|
||||
# outer case is for safety in case variable is blank or something
|
||||
if [ -d "$MTMOD_UNZ_NAME/.git" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.git"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/.gitignore" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.gitignore"
|
||||
fi
|
||||
# remove etc to make users downloading mods faster:
|
||||
if [ -d "$MTMOD_UNZ_NAME/etc" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/etc"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/screenshot.png" ]; then
|
||||
rm -f "$MTMOD_UNZ_NAME/screenshot.png"
|
||||
fi
|
||||
sudo mv $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
if [ ! -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo " ERROR: failed to unzip $MTMOD_DEST_PATH, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
else
|
||||
echo " added as $MTMOD_DEST_PATH"
|
||||
fi
|
||||
cd
|
||||
#if [ -d GitHub/EnlivenMinetest ]; then
|
||||
# cd GitHub/EnlivenMinetest
|
||||
#fi
|
||||
}
|
||||
|
||||
add_git_mod()
|
||||
{
|
||||
cd $HOME/Downloads
|
||||
MTMOD_DEST_NAME=$1
|
||||
MTMOD_UNZ_NAME=$2
|
||||
URL=$3
|
||||
BRANCH=$4
|
||||
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
|
||||
if [ ! -d "$MTMOD_DEST_PATH" ] || [ "$update_enable" = "true" ]; then
|
||||
if [ ! -z "`ls | grep $MTMOD_UNZ_NAME`" ]; then # works with wildcard in variable
|
||||
rm -Rf $MTMOD_UNZ_NAME
|
||||
fi
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo "removing old $MTMOD_DEST_PATH"
|
||||
sudo rm -Rf "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
if [ ! -z "$BRANCH" ]; then
|
||||
echo "Cloning $BRANCH branch..."
|
||||
git clone -b $BRANCH --single-branch $URL
|
||||
else
|
||||
echo "Cloning main branch since no branch specified: $BRANCH"
|
||||
git clone $URL
|
||||
fi
|
||||
if [ -d "$MTMOD_UNZ_NAME" ]; then
|
||||
# outer case is for safety in case variable is blank or something
|
||||
if [ -d "$MTMOD_UNZ_NAME/.git" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.git"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/.gitignore" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/.gitignore"
|
||||
fi
|
||||
# remove etc to make users downloading mods faster:
|
||||
if [ -d "$MTMOD_UNZ_NAME/etc" ]; then
|
||||
rm -Rf "$MTMOD_UNZ_NAME/etc"
|
||||
fi
|
||||
if [ -f "$MTMOD_UNZ_NAME/screenshot.png" ]; then
|
||||
rm -f "$MTMOD_UNZ_NAME/screenshot.png"
|
||||
fi
|
||||
sudo mv $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH"
|
||||
fi
|
||||
if [ ! -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo " ERROR: failed to unzip $MTMOD_DEST_PATH, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
else
|
||||
echo " [ + ] added as $MTMOD_DEST_PATH"
|
||||
fi
|
||||
cd
|
||||
#if [ -d GitHub/EnlivenMinetest ]; then
|
||||
# cd GitHub/EnlivenMinetest
|
||||
#fi
|
||||
else
|
||||
echo " [ ~ ] skipped existing $MTMOD_DEST_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
remove_mod()
|
||||
{
|
||||
cd $HOME/Downloads
|
||||
MTMOD_DEST_NAME=$1
|
||||
MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
sudo rm -Rf "$MTMOD_DEST_PATH"
|
||||
if [ -d "$MTMOD_DEST_PATH" ]; then
|
||||
echo " ERROR in remove_mod: failed to remove $MTMOD_DEST_PATH, so cannot continue." > $err_txt
|
||||
cat $err_txt
|
||||
echo " press Ctrl C to cancel ENLIVEN install or this terminal will close..."
|
||||
sleep 1
|
||||
echo " 3..."
|
||||
sleep 1
|
||||
echo " 2..."
|
||||
sleep 1
|
||||
echo " 1..."
|
||||
sleep 1
|
||||
exit 1
|
||||
else
|
||||
echo " [ - ] removed $MTMOD_DEST_PATH"
|
||||
fi
|
||||
else
|
||||
echo " [ - ] already not present: $MTMOD_DEST_PATH"
|
||||
fi
|
||||
cd
|
||||
#if [ -d GitHub/EnlivenMinetest ]; then
|
||||
# cd GitHub/EnlivenMinetest
|
||||
#fi
|
||||
}
|
||||
#echo "MT_MYGAME_MODS_PATH: $MT_MYGAME_MODS_PATH"
|
||||
echo
|
||||
echo
|
||||
echo "To preconfigure, write true or false to files in $CONFIGS_PATH named:"
|
||||
echo " local_enable"
|
||||
echo " version_0_5_enable"
|
||||
echo
|
||||
echo "Using following configuration:"
|
||||
if [ -z "$version_0_5_enable" ]; then
|
||||
echo " version_0_5_enable: (auto--set this var before pasting region into terminal)"
|
||||
else
|
||||
echo " version_0_5_enable: $version_0_5_enable"
|
||||
fi
|
||||
if [ -z "$local_enable" ]; then
|
||||
echo " local_enable: (auto--set this var before pasting region into terminal)"
|
||||
else
|
||||
echo "local_enable: $local_enable"
|
||||
fi
|
||||
echo " USR_SHARE_MINETEST: $USR_SHARE_MINETEST"
|
||||
echo " MT_MYGAME_DIR: $MT_MYGAME_DIR"
|
||||
echo " MT_WORLDS_DIR: $MT_WORLDS_DIR"
|
||||
echo " MT_MYWORLD_NAME: $MT_MYWORLD_NAME"
|
||||
echo " MT_MINETEST_GAME_PATH: $MT_MINETEST_GAME_PATH"
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
|
||||
#LOCAL_REPO_DIR=$HOME/Downloads/minetest
|
||||
#if [ ! -f "$LOCAL_REPO_DIR/install_manifest.txt" ]; then
|
||||
# echo "missing $LOCAL_REPO_DIR/install_manifest.txt, cannot uninstall unless you properly run cmake source and are running this script from the base repo directory (only runs from that specific location specified for safety)"
|
||||
if [ ! -f "install_manifest.txt" ]; then
|
||||
echo "missing install_manifest.txt, cannot uninstall unless you properly run cmake source and are running this script from the base repo directory"
|
||||
exit 1
|
||||
fi
|
||||
#cd "$LOCAL_REPO_DIR"
|
||||
sudo xargs rm < install_manifest.txt
|
||||
if [ -d /usr/local/mods ]; then
|
||||
echo "Remove botched folders from faulty make install path apparently caused by running sudo make install without -DRUN_IN_PLACE=FALSE"
|
||||
echo "This should be safe since only removes directories if empty (except removes /usr/local/mods recursively)..."
|
||||
rmdir /usr/local/mods
|
||||
rmdir /usr/local/textures
|
||||
rmdir /usr/local/games
|
||||
rmdir /usr/local/fonts
|
||||
rmdir /usr/local/builtin
|
||||
rmdir /usr/local/doc
|
||||
rmdir /usr/local/unix
|
||||
rmdir /usr/local/fonts
|
||||
if [ -d /usr/local/mods/default ]; then
|
||||
sudo rm -Rf /usr/local/mods
|
||||
elif [ -d /usr/local/mods ]; then
|
||||
sudo rmdir /usr/local/mods
|
||||
if [ -d /usr/local/mods ]; then
|
||||
echo "WARNING: not removing errant /usr/local/mods, since not unrecognized (no /usr/local/mods/default found)"
|
||||
fi
|
||||
fi
|
||||
sudo rmdir /usr/local/textures
|
||||
sudo rmdir /usr/local/doc
|
||||
sudo rmdir /usr/local/fonts
|
||||
if [ -d /usr/local/unix ]; then
|
||||
echo "WARNING: not removing deprecated folder since may not be an errant minetest folder: /usr/local/unix"
|
||||
echo "(to resolve this issue at your own risk, open $me then paste everything indented below the 'exit 0' line into a terminal"
|
||||
exit 0
|
||||
sudo rmdir /usr/local/unix/*
|
||||
#rmdir: failed to remove 'icons': Directory not empty
|
||||
#rmdir: failed to remove 'man': Directory not empty
|
||||
sudo rmdir /usr/local/unix/man/man6
|
||||
sudo rmdir /usr/local/unix/man
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/128x128/*
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/128x128
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/scalable/*
|
||||
sudo rmdir /usr/local/unix/icons/hicolor/scalable
|
||||
sudo rmdir /usr/local/unix/icons/hicolor
|
||||
sudo rmdir /usr/local/unix/icons
|
||||
sudo rmdir /usr/local/unix
|
||||
sudo rmdir /usr/local/builtin/*
|
||||
sudo rmdir /usr/local/builtin
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "`command -v update-desktop-database`" ]; then
|
||||
echo "updating desktop database as per https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=minetest-git"
|
||||
update-desktop-database &>/dev/null && update-desktop-database -q
|
||||
fi
|
||||
if [ -f "`command -v gtk-update-icon-cache`" ]; then
|
||||
echo "updating gtk icon cache as per https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=minetest-git"
|
||||
gtk-update-icon-cache &>/dev/null && gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
|
||||
fi
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import platform
|
||||
CMD_REM = "#"
|
||||
CMD_RM = "rm "
|
||||
CMD_RMDIR = "rmdir "
|
||||
if platform.system() == "Windows":
|
||||
CMD_REM = "REM "
|
||||
CMD_RM = "del "
|
||||
CMD_RMDIR = "rd "
|
||||
#profile_path = None
|
||||
#if 'HOME' in os.environ:
|
||||
# profile_path = os.environ['HOME']
|
||||
#elif 'USERPROFILE' in os.environ:
|
||||
# profile_path = os.environ['USERPROFILE']
|
||||
#downloads_path = os.path.join(profile_path, "Downloads")
|
||||
#repo_path = os.path.join(downloads_path, "minetest")
|
||||
#if not os.path.isdir(repo_path):
|
||||
# repo_path = os.path.join(profile_path, "minetest")
|
||||
#if not os.path.isdir(repo_path):
|
||||
# print("ERROR: Nothing done since there is no minetest sourcecode folder in " + downloads_path + " (nor " + profile_path + ")")
|
||||
# exit(1)
|
||||
install_manifest_name = "install_manifest.txt"
|
||||
#install_manifest_path = os.path.join(repo_path, install_manifest_name)
|
||||
#if not os.path.isfile(install_manifest_path):
|
||||
# print("ERROR: nothing done since there is no " +
|
||||
# install_manifest_name + " in '" + repo_path +
|
||||
# "'. The file would only be present if you " +
|
||||
# "installed minetest from sourcecode" +
|
||||
# "(otherwise this uninstaller is not for you).")
|
||||
# exit(2)
|
||||
if not os.path.isfile(install_manifest_name):
|
||||
print("ERROR: nothing done since there is no " +
|
||||
install_manifest_name + " in the current " +
|
||||
"directory. You must run: ")
|
||||
print(" sudo python3 "+os.path.abspath(__file__))
|
||||
print("from the minetest sourcecode (repo) directory.")
|
||||
exit(2)
|
||||
directories = []
|
||||
print("Removing files...")
|
||||
f_removed_count = 0
|
||||
f_skipped_count = 0
|
||||
f_failed_count = 0
|
||||
retry_lines = []
|
||||
with open(install_manifest_name, 'r') as ins:
|
||||
original_line = True
|
||||
while original_line:
|
||||
original_line = ins.readline()
|
||||
if original_line:
|
||||
line = original_line.rstrip() # remove trailing newline
|
||||
if len(line)>0:
|
||||
d_path = os.path.dirname(line)
|
||||
if d_path not in directories:
|
||||
if "minetest" in d_path:
|
||||
directories.append(d_path)
|
||||
# else must be a system directory like
|
||||
# /usr/local/share/applications
|
||||
if os.path.isfile(line):
|
||||
os.remove(line)
|
||||
if os.path.isfile(line):
|
||||
f_failed_count += 1
|
||||
retry_lines.append(CMD_RM+'"'+line+'"')
|
||||
else:
|
||||
f_removed_count += 1
|
||||
else:
|
||||
f_skipped_count += 1
|
||||
|
||||
print("Removed " + str(f_removed_count) + " file(s) (skipped not present:" +
|
||||
str(f_skipped_count) + "; failed:" + str(f_failed_count) + ")")
|
||||
|
||||
#NOTE: the next line makes ASCENDING (by len) list of TUPLES (name,len)
|
||||
sorted_directories = [(x, len(x)) for x in sorted(directories, key = len)]
|
||||
|
||||
print("Removing folders...")
|
||||
#NOTE: they are sorted ASCENDING so start at end:
|
||||
d_removed_count = 0
|
||||
d_skipped_count = 0
|
||||
d_failed_count = 0
|
||||
|
||||
#still leaves:
|
||||
# /usr/local/share/minetest/games/minetest_game/mods
|
||||
# /usr/local/share/minetest/textures/base/pack/:
|
||||
# down_arrow.png left_arrow.png right_arrow.png up_arrow.png
|
||||
# /usr/local/share/minetest/games/minimal/mods
|
||||
# so:
|
||||
try_files = ["depends.txt", "down_arrow.png", "left_arrow.png", "right_arrow.png", "up_arrow.png"]
|
||||
try_dirs = ["mods"]
|
||||
|
||||
extra_dirs = []
|
||||
ed_failed_count = 0
|
||||
ed_removed_count = 0
|
||||
extra_files = []
|
||||
e_failed_count = 0
|
||||
e_removed_count = 0
|
||||
for i in reversed(range(len(sorted_directories))):
|
||||
d_path = sorted_directories[i][0]
|
||||
#for d in reversed(sorted_directories):
|
||||
# d_path = d[0]
|
||||
# print("checking "+str(d_path))
|
||||
if os.path.isdir(d_path):
|
||||
try:
|
||||
for try_name in try_files:
|
||||
try_path = os.path.join(d_path, try_name)
|
||||
if os.path.isfile(try_path):
|
||||
extra_files.append(try_path)
|
||||
print('Removing known extra file: "' + try_path + '"')
|
||||
try:
|
||||
os.remove(try_path)
|
||||
e_removed_count += 1
|
||||
except Exception as e:
|
||||
e_failed_count += 1
|
||||
retry_lines.append(CMD_RM+'"'+try_path+'"')
|
||||
print(str(e))
|
||||
for try_name in try_dirs:
|
||||
try_path = os.path.join(d_path, try_name)
|
||||
if os.path.isdir(try_path):
|
||||
extra_dirs.append(try_path)
|
||||
print('Removing known extra folder: "' + try_path + '"')
|
||||
try:
|
||||
os.rmdir(try_path)
|
||||
ed_removed_count += 1
|
||||
except Exception as e:
|
||||
ed_failed_count += 1
|
||||
retry_lines.append(CMD_RMDIR+'"'+try_path+'"')
|
||||
print(str(e))
|
||||
os.rmdir(d_path)
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
if os.path.isdir(d_path):
|
||||
d_failed_count += 1
|
||||
retry_lines.append(CMD_RMDIR+'"'+d_path+'"')
|
||||
else:
|
||||
d_removed_count += 1
|
||||
else:
|
||||
d_skipped_count += 1
|
||||
print("Removed " + str(d_removed_count) + " folder(s) (skipped not present:" +
|
||||
str(d_skipped_count) + "; failed:" + str(d_failed_count) + ")")
|
||||
if e_failed_count > 0:
|
||||
print("(failed to remove " + e_failed_count + " known extra file(s) " +
|
||||
"(will be shown under FAILURES below)")
|
||||
if ed_failed_count > 0:
|
||||
print("(failed to remove " + ed_failed_count + " known extra folder(s) " +
|
||||
"(will be shown under FAILURES below)")
|
||||
print("Removed " + str(d_removed_count) + " folder(s) (skipped not present:" +
|
||||
str(d_skipped_count) + "; failed:" + str(d_failed_count) + ")")
|
||||
|
||||
if f_failed_count+d_failed_count+ed_failed_count <= 0:
|
||||
print("")
|
||||
if f_removed_count+d_removed_count <= 0:
|
||||
print("Nothing to do (minetest+minetestserver has 0 known files on system--you apparently already uninstalled the local version that was installed using 'sudo make install')")
|
||||
else:
|
||||
print("OK [finished uninstalling all installed files]")
|
||||
print("")
|
||||
else:
|
||||
print("")
|
||||
print("")
|
||||
print(CMD_REM+"FAILURES:")
|
||||
for rl in retry_lines:
|
||||
print(rl)
|
||||
print("")
|
||||
print("In case of any failures are counted above, "
|
||||
"try running this script with administrative privileges."
|
||||
"If any more remain, you may have to remove them manually.")
|
||||
print("")
|
||||
print("")
|
||||
if not ins.closed:
|
||||
print("ERROR: ins was not closed (this should never happen)--"
|
||||
"closing manually...")
|
||||
ins.close()
|
|
@ -57,15 +57,23 @@ if [ -d "$HOME/Downloads/minetest" ]; then
|
|||
if [ -f init.1st ]; then
|
||||
sudo rm init.1st
|
||||
fi
|
||||
sudo mv init.lua init.bak
|
||||
sudo wget https://github.com/poikilos/minetest_game/raw/master/mods/bones/init.lua
|
||||
sudo mv -f init.lua init.bak
|
||||
sudo wget -O init.lua https://github.com/poikilos/minetest_game/raw/master/mods/bones/init.lua
|
||||
cd "$HOME/Downloads"
|
||||
if [ ! -d mods ]; then
|
||||
mkdir mods
|
||||
fi
|
||||
cd mods
|
||||
if [ ! -d farming ]; then
|
||||
git clone https://github.com/tenplus1/farming.git
|
||||
if [ -d ../farming ]; then
|
||||
mv ../farming ./
|
||||
else
|
||||
git clone https://github.com/tenplus1/farming.git
|
||||
fi
|
||||
else
|
||||
cd farming
|
||||
git pull
|
||||
cd ..
|
||||
cd ../..
|
||||
fi
|
||||
sudo rm -Rf "$MT_MYGAME_DIR/mods/farming"
|
||||
sudo cp -Rf farming "$MT_MYGAME_DIR/mods/"
|
Loading…
Reference in New Issue