poikilos
7 years ago
committed by
Jacob Gustafson
23 changed files with 738 additions and 523 deletions
@ -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 |
|
@ -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() |
Loading…
Reference in new issue