fast deployment files
You can not 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

  1. #!/bin/bash
  2. # Script para desplegar un servidor minetest sobre Debian 10
  3. minetestUrlReleases="https://github.com/minetest/minetest/archive/refs/tags"
  4. minetestVersion="5.4.1"
  5. minetestUrlSourceCode="$minetestUrlReleases/$minetestVersion.tar.gz"
  6. minetestDirTmp="/tmp/minetest-$minetestVersion.tar.gz"
  7. minetestDirConfig="/etc/minetest"
  8. main (){
  9. updateSys
  10. installDependencies
  11. downloadMinetest
  12. extractMinetest
  13. compileMinetest
  14. copyConfMinetestServer
  15. downloadMinetest_game
  16. downloadIkea_game
  17. downloadRpgtest_game
  18. }
  19. isOK (){
  20. if [ $? -eq 0 ]
  21. then
  22. echo -e "$taskName\e[32m [OK]\e[0m"
  23. else
  24. echo -e "$taskName\e[31m [NOTOK]\e[0m"
  25. exit 1
  26. fi
  27. }
  28. updateSys (){
  29. taskName="Update System"; echo -e "\n[+][$taskName]"
  30. apt -qq update && apt -qq upgrade -y > /dev/null 2>&1
  31. isOK
  32. }
  33. installDependencies (){
  34. taskName="Install dependencies"; echo -e "\n[+][$taskName]"
  35. 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"
  36. 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
  37. isOK
  38. }
  39. downloadMinetest (){
  40. taskName="Download Minetest source version $minetestVersion"; echo -e "\n[+][$taskName]"
  41. wget -q "$minetestUrlSourceCode" -O $minetestDirTmp
  42. isOK
  43. }
  44. extractMinetest (){
  45. taskName="Extract Minetest source version $minetestVersion"; echo -e "\n[+][$taskName]"
  46. tar -xf $minetestDirTmp -C /tmp/
  47. isOK
  48. }
  49. compileMinetest (){
  50. taskName="Compile Minetest source version $minetestVersion"; echo -e "\n[+][$taskName]"
  51. cd /tmp/minetest-$minetestVersion
  52. pwd
  53. echo "Compiling in 3";sleep 1
  54. echo "Compiling in 2";sleep 1
  55. echo "Compiling in 1";sleep 1
  56. sleep 3
  57. 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
  58. make -j$(nproc)
  59. make install
  60. isOK
  61. }
  62. copyConfMinetestServer (){
  63. taskName="Copy config file to $minetestDirConfig/"; echo -e "\n[+][$taskName]"
  64. mkdir -p $minetestDirConfig
  65. cp -pR /tmp/minetest-$minetestVersion/minetest.conf.example $minetestDirConfig/minetest.conf
  66. isOK
  67. }
  68. downloadMinetest_game (){
  69. taskName="Download example game. BASE GAME: minetest_game"; echo -e "\n[+][$taskName]"
  70. rm -rf /usr/local/share/minetest/games/minetest_game
  71. git clone https://github.com/minetest/minetest_game /usr/local/share/minetest/games/minetest_game
  72. isOK
  73. }
  74. downloadIkea_game (){
  75. taskName="Download Ikea game"; echo -e "\n[+][$taskName]"
  76. rm -rf /usr/local/share/minetest/games/ikea
  77. git clone https://gitlab.com/benrob0329/ikea.git /usr/local/share/minetest/games/ikea
  78. isOK
  79. }
  80. downloadRpgtest_game (){
  81. taskName="Download rpgtest game"; echo -e "\n[+][$taskName]"
  82. rm -rf /usr/local/share/minetest/games/rpgtest
  83. git clone https://github.com/cdqwertz/rpgtest /usr/local/share/minetest/games/rpgtest
  84. isOK
  85. }
  86. main
  87. echo -e "\n"
  88. echo "To run the server. Examples:"
  89. echo "minetestserver --config /etc/minetest/minetest.conf --world /usr/local/share/minetest/games/"
  90. echo "minetestserver --config /etc/minetest/minetest.conf --gameid rpgtest"