From 0cf607b66ee8233f772cbce2118c5f64b2134a1f Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Wed, 15 Aug 2018 16:19:35 -0400 Subject: [PATCH] working on minetestenv and desktop detection --- install-minetestserver-git-all-backends.sh | 36 ++++++++++-- minetestenv.rc | 66 ++++++++++++---------- 2 files changed, 68 insertions(+), 34 deletions(-) diff --git a/install-minetestserver-git-all-backends.sh b/install-minetestserver-git-all-backends.sh index 771ec7d..1c3b258 100755 --- a/install-minetestserver-git-all-backends.sh +++ b/install-minetestserver-git-all-backends.sh @@ -4,12 +4,28 @@ if [ -f "`command -v apt`" ]; then sudo apt update fi +msg="Installing minetestserver ONLY (no param specified). If you want to install the client on your server (not normal practice) or are on a computer with a graphical desktop, add client or both param when calling this script." +warnings="" +if [ "$1" = "both" ]; then + msg="Installing minetest client AND server (param specified: both)." +elif [ "$1" = "client" ]; then + msg="Installing minetest client ONLY (param specified: client)." +else + if [ ! -z "$XDG_CURRENT_DESKTOP" ]; then + warnings="WARNING: Detected $XDG_CURRENT_DESKTOP...you probably meant to install client or both (use client or both param after this script)" + fi +fi echo "This script compiles AND installs minetestserver (NOT run-in-place, but rather system-wide) with leveldb, redis, and defaults postgresql, doxygen, sqlite3" 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." +echo $msg +echo $warnings +if [ ! -z "$warnings" ]; then + echo "You may want to cancel and correct warnings above..." + sleep 2 +fi #if [ -f "`command -v minetest`" ]; then -echo "Removing the non-git (packaged) version first (Press Ctrl C to cancel)..." +echo "* trying to remove any non-git (packaged) version first (Press Ctrl C to cancel)..." #fi sleep 1 echo "3..." @@ -19,7 +35,7 @@ sleep 1 echo "1..." sleep 1 echo -if [ -f "`command -v apt`" ]; then +if [ `which apt` ]; then sudo apt -y remove minetest-server sudo apt -y remove minetest sudo apt -y install libncurses5-dev libgettextpo-dev doxygen libspatialindex-dev libpq-dev postgresql-server-dev-all @@ -30,14 +46,14 @@ if [ -f "`command -v apt`" ]; then sudo apt -y install libpng12-dev libjpeg8-dev # Debian: sudo apt -y install libpng-dev libjpeg-dev -elif [ -f "`command -v pacman`" ]; then +elif [ `which pacman` ]; then sudo pacman -R --noconfirm minetest-server sudo pacman -R --noconfirm minetest echo "detected arch-based distro (tested only on antergos)..." # NOTE: the regular packages include headers on arch-based distros: sudo pacman -Syyu --noconfirm git spatialindex postgresql-libs doxygen postgresql-libs hiredis redis irrlicht gettext freetype2 bzip2 libpng libjpeg-turbo libxxf86vm mesa glu sqlite libogg libvorbis openal curl luajit leveldb ncurses redis hiredis gmp #can't find equivalent to libjpeg8-dev libxxf86vm-dev mesa sqlite libogg vorbis -elif [ -f "`command -v dnf`" ]; then +elif [ `which dnf` ]; then sudo dnf -y remove minetest-server sudo dnf -y remove minetest #see poikilos post at https://forum.minetest.net/viewtopic.php?f=42&t=3837&start=125 @@ -52,6 +68,16 @@ elif [ -f "`command -v dnf`" ]; then #sudo make install #minetest # echo -e "\n\n\e[1;33mYou can run Minetest again by typing \"minetest\" in a terminal or selecting it in an applications menu.\nYou can install mods in ~/.minetest/mods, too.\e[0m" +else + echo "WARNING: cannot remove packaged version, because your package manager is not known by this script." + echo "Press Ctrl C to cancel, or wait to continue anyway..." + sleep 1 + echo "3..." + sleep 1 + echo "2..." + sleep 1 + echo "1..." + sleep 1 fi cd diff --git a/minetestenv.rc b/minetestenv.rc index 06e6227..02b45be 100644 --- a/minetestenv.rc +++ b/minetestenv.rc @@ -1,4 +1,4 @@ - + CONFIGS_PATH="$HOME/.config/EnlivenMinetest" if [ ! -d "$CONFIGS_PATH" ]; then mkdir -p "$CONFIGS_PATH" @@ -15,35 +15,26 @@ if [ "$1" = "--help" ]; then 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 + +#NOTE: version_0_5_enable is now detected further down instead of being specified +#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 [ "$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" -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 @@ -108,12 +99,29 @@ 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 + #if [ -z "$version_0_5_enable" ]; then + # version_0_5_enable="true" + #fi USR_SHARE_MINETEST="$try_path" fi fi +version_0_5_enable="false" +if [ -d "$USR_SHARE_MINETEST/games/minetest_game/mods/player_api" ]; then + version_0_5_enable="true" +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 + mtgame_name="minetest_game" MT_MINETEST_GAME_PATH=$USR_SHARE_MINETEST/games/$mtgame_name #echo "3..."