You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
4.0 KiB
Bash

#!/bin/bash
# Script para desplegar un servidor minetest sobre Debian 10
minetestUrlReleases="https://github.com/minetest/minetest/archive/refs/tags"
minetestVersion="5.4.1"
minetestUrlSourceCode="$minetestUrlReleases/$minetestVersion.tar.gz"
minetestDirTmp="/tmp/minetest-$minetestVersion.tar.gz"
minetestDirConfig="/etc/minetest"
main (){
updateSys
installDependencies
downloadMinetest
extractMinetest
compileMinetest
copyConfMinetestServer
downloadMinetest_game
downloadIkea_game
downloadRpgtest_game
}
isOK (){
if [ $? -eq 0 ]
then
echo -e "$taskName\e[32m [OK]\e[0m"
else
echo -e "$taskName\e[31m [NOTOK]\e[0m"
exit 1
fi
}
updateSys (){
taskName="Update System"; echo -e "\n[+][$taskName]"
apt -qq update && apt -qq upgrade -y > /dev/null 2>&1
isOK
}
installDependencies (){
taskName="Install dependencies"; echo -e "\n[+][$taskName]"
echo -e "git\npostgresql\npostgresql-server-dev-11\ncurl\nlibspatialindex-dev\ndoxygen\nlibbz2-dev\ngettext\nlibirrlicht-dev\nlibluajit-5.1-dev\nluajit\nlibncurses-dev\ng++\nmake\nlibc6-dev\ncmake\nlibpng-dev\nlibjpeg-dev\nlibxxf86vm-dev\nlibgl1-mesa-dev\nlibsqlite3-dev\nlibogg-dev\nlibvorbis-dev\nlibopenal-dev\nlibcurl4-gnutls-dev\nlibfreetype6-dev\nzlib1g-dev\nlibgmp-dev\nlibjsoncpp-dev\nwget"
apt -qq -y install git postgresql postgresql-server-dev-11 curl libspatialindex-dev doxygen libbz2-dev gettext libirrlicht-dev luajit libluajit-5.1-dev libncurses-dev g++ make libc6-dev cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev wget > /dev/null 2>&1
isOK
}
downloadMinetest (){
taskName="Download Minetest source version $minetestVersion"; echo -e "\n[+][$taskName]"
wget -q "$minetestUrlSourceCode" -O $minetestDirTmp
isOK
}
extractMinetest (){
taskName="Extract Minetest source version $minetestVersion"; echo -e "\n[+][$taskName]"
tar -xf $minetestDirTmp -C /tmp/
isOK
}
compileMinetest (){
taskName="Compile Minetest source version $minetestVersion"; echo -e "\n[+][$taskName]"
cd /tmp/minetest-$minetestVersion
pwd
echo "Compiling in 3";sleep 1
echo "Compiling in 2";sleep 1
echo "Compiling in 1";sleep 1
sleep 3
cmake . -DRUN_IN_PLACE=FALSE -DBUILD_SERVER=TRUE -DBUILD_CLIENT=FALSE -DENABLE_REDIS=OFF -DENABLE_LEVELDB=OFF -DCMAKE_BUILD_TYPE=Release -DENABLE_CURL=ON -DENABLE_CURSES=ON -DENABLE_FREETYPE=ON -DENABLE_GETTEXT=ON -DENABLE_POSTGRESQL=ON -DENABLE_SPATIAL=ON -DENABLE_SOUND=ON -DENABLE_LUAJIT=ON -DENABLE_PROMETHEUS=OFF -DENABLE_SYSTEM_GMP=ON -DPostgreSQL_LIBRARY=/usr/lib/x86_64-linux-gnu/libpq.so.5
make -j$(nproc)
make install
isOK
}
copyConfMinetestServer (){
taskName="Copy config file to $minetestDirConfig/"; echo -e "\n[+][$taskName]"
mkdir -p $minetestDirConfig
cp -pR /tmp/minetest-$minetestVersion/minetest.conf.example $minetestDirConfig/minetest.conf
isOK
}
downloadMinetest_game (){
taskName="Download example game. BASE GAME: minetest_game"; echo -e "\n[+][$taskName]"
rm -rf /usr/local/share/minetest/games/minetest_game
git clone https://github.com/minetest/minetest_game /usr/local/share/minetest/games/minetest_game
isOK
}
downloadIkea_game (){
taskName="Download Ikea game"; echo -e "\n[+][$taskName]"
rm -rf /usr/local/share/minetest/games/ikea
git clone https://gitlab.com/benrob0329/ikea.git /usr/local/share/minetest/games/ikea
isOK
}
downloadRpgtest_game (){
taskName="Download rpgtest game"; echo -e "\n[+][$taskName]"
rm -rf /usr/local/share/minetest/games/rpgtest
git clone https://github.com/cdqwertz/rpgtest /usr/local/share/minetest/games/rpgtest
isOK
}
main
echo -e "\n"
echo "To run the server. Examples:"
echo "minetestserver --config /etc/minetest/minetest.conf --world /usr/local/share/minetest/games/"
echo "minetestserver --config /etc/minetest/minetest.conf --gameid rpgtest"