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."
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=""
warnings=""
if["$1"="both"];then
if["$1"="both"];then
msg="Installing minetest client AND server (param specified: both)."
msg="Installing minetest client AND server (param specified: both)."
elif["$1"="client"];then
elif["$1"="client"];then
msg="Installing minetest client ONLY (param specified: client)."
msg="Installing minetest client ONLY (param specified: client)."
else
else
if[ ! -z "$XDG_CURRENT_DESKTOP"];then
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)"
warnings="WARNING: Detected $XDG_CURRENT_DESKTOP...you probably meant to install client or both (use client or both param after this script)"
fi
fi
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"This script compiles AND installs minetestserver (NOT run-in-place, but rather system-wide) with leveldb, redis, and defaults postgresql, doxygen, sqlite3"
echo
echo
@ -21,8 +21,8 @@ echo
echo$msg
echo$msg
echo$warnings
echo$warnings
if[ ! -z "$warnings"];then
if[ ! -z "$warnings"];then
echo"You may want to cancel and correct warnings above..."
echo"You may want to cancel and correct warnings above..."
sleep 2
sleep 2
fi
fi
#if [ -f "`command -v minetest`" ]; then
#if [ -f "`command -v minetest`" ]; then
echo"* trying to remove any 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)..."
# added libpq-dev postgresql-server-dev-all (or specific version) are BOTH needed for PostgreSQL development as per https://stackoverflow.com/questions/13920383/findpostgresql-cmake-wont-work-on-ubuntu
# added libpq-dev postgresql-server-dev-all (or specific version) are BOTH needed for PostgreSQL development as per https://stackoverflow.com/questions/13920383/findpostgresql-cmake-wont-work-on-ubuntu
# if you skip the above, the next step says missing: GetText, Curses, ncurses, Redis, SpatialIndex, Doxygen
# if you skip the above, the next step says missing: GetText, Curses, ncurses, Redis, SpatialIndex, Doxygen
# sudo apt -y install liblua5.3-dev # still missing lua.h after this
# sudo apt -y install liblua5.3-dev # still missing lua.h after this
# so see "-DLUA_INCLUDE_DIR" below instead
# so see "-DLUA_INCLUDE_DIR" below instead
#luajit_path="/usr/include/lua5.1"
#luajit_path="/usr/include/lua5.1"
if[ -d "$luajit_path"];then
if[ -d "$luajit_path"];then
ext_lua=" -DLUA_INCLUDE_DIR=$luajit_path"
ext_lua=" -DLUA_INCLUDE_DIR=$luajit_path"
else
else
echo"WARNING: may not be able to find lua.h on Debian-based system on 2018+ versions of minetest if you do not have the packaged version of luajit installed in the '$luajit_path' directory..."
echo"WARNING: may not be able to find lua.h on Debian-based system on 2018+ versions of minetest if you do not have the packaged version of luajit installed in the '$luajit_path' directory..."
sleep 2
sleep 2
fi
fi
# Debian:
# Debian:
sudo apt -y install libpng-dev libjpeg-dev
sudo apt -y install libpng-dev libjpeg-dev
elif[ -f "`command -v pacman`"];then
elif[ -f "`command -v pacman`"];then
sudo pacman -R --noconfirm minetest-server
sudo pacman -R --noconfirm minetest-server
sudo pacman -R --noconfirm minetest
sudo pacman -R --noconfirm minetest
echo"detected arch-based distro (tested only on antergos)..."
echo"detected arch-based distro (tested only on antergos)..."
# NOTE: the regular packages include headers on arch-based distros:
# NOTE: the regular packages include headers on arch-based distros:
# 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"
# 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
else
echo"WARNING: cannot remove packaged version, because your package manager is not known by this script."
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..."
echo"Press Ctrl C to cancel, or wait to continue anyway..."
sleep 1
sleep 1
echo"3..."
echo"3..."
sleep 1
sleep 1
echo"2..."
echo"2..."
sleep 1
sleep 1
echo"1..."
echo"1..."
sleep 1
sleep 1
fi
fi
cd
cd
if[ ! -d "Downloads"];then
if[ ! -d "Downloads"];then
mkdir Downloads
mkdir Downloads
fi
fi
cd Downloads
cd Downloads
#if [ -d minetest ]; then
#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 "ERROR: Nothing done since 'minetest' already exists in `pwd`--delete it before cloning, or run the included update script to update."
echo -e "\n\n\e[1;33mYou can run Minetest Server by typing \"minetestserver\" in a terminal, but using mtsenliven.py is recommended instead and keeps a config file for what world and subgame you want via minetestinfo.py.\e[0m"
echo -e "\n\n\e[1;33mYou can run Minetest Server by typing \"minetestserver\" in a terminal, but using mtsenliven.py is recommended instead and keeps a config file for what world and subgame you want via minetestinfo.py.\e[0m"