initial deploy script. minetest

master
fanta 3 years ago
parent def7d3369d
commit 4fc30c0cf1

@ -0,0 +1,98 @@
#!/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"
minetestDirBin="/usr/bin"
minetestDirConfig="/etc/minetest"
minetestDirResources="/usr/share/minetest"
main (){
updateSys
installDependencies
downloadMinetest
extractMinetest
compileMinetest
copyBinMinetestServer
copyConfMinetestServer
copyDefaultWorld
}
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=TRUE -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)
isOK
}
copyBinMinetestServer (){
taskName="Copy binary file: minetestserver to $minetestDirBin/"; echo -e "\n[+][$taskName]"
cp -pR /tmp/minetest-$minetestVersion/bin/minetestserver $minetestDirBin/
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
}
copyConfMinetestServer (){
taskName="make resource directories on $minetestDirResources"; echo -e "\n[+][$taskName]"
mkdir -p $minetestDirResources $minetestDirResources/worlds
isOK
}
copyDefaultWorld (){
taskName="Download minetest_game"; echo -e "\n[+][$taskName]"
cd $minetestDirResources/worlds
git clone https://github.com/minetest/minetest_game.git minetest_game
isOK
}
main
Loading…
Cancel
Save