From a19b489a2ef2682f82c5619d00b05f7584ca3a67 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Oct 2020 10:50:32 +0000 Subject: [PATCH] edit_minetest.conf --- config-file | 17 ++++++++++++++++- setup-mt | 30 +++++++++++++++++++++++++++++- test | 16 ++++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 test diff --git a/config-file b/config-file index 5b2827e1..820a6cd6 100644 --- a/config-file +++ b/config-file @@ -1,6 +1,21 @@ mt_version="5.3.0" -first_install=Y +first_install=y +ufw_enable=y +ufw_ssh_port_for_accept=22 #This settings are applied only when first_install is set to Y psql_postgres_user_password="ExamplePassword" psql_minetest_user_password="ExamplePassword" +mt_port=30000 +mt_admin=admin +mt_language=en +mt_enable_rollback_recording=true +mt_default_privs="interact, shout, home" +mt_max_users=40 +mt_motd="SERVER CREATED BY https://git.my-web.xyz/milan/minetest-mm.git" +mt_ipv6_server=false +mt_server_announce=false +mt_server_url="https://example.tld" +mt_server_address="example.tld" +mt_server_description="SERVER CREATED BY https://git.my-web.xyz/milan/minetest-mm.git" +mt_server_name="my minetest-mm server" diff --git a/setup-mt b/setup-mt index d93da8f1..e7150b87 100755 --- a/setup-mt +++ b/setup-mt @@ -69,7 +69,13 @@ echo "[Install]" >> /etc/systemd/system/minetestsrv.service echo "WantedBy=multi-user.target" >> /etc/systemd/system/minetestsrv.service systemctl daemon-reload -if [ $first_install = "Y" ]; then +if [ $ufw_enable = "y" ]; then +apt install ufw -y +ufw allow proto tcp from any port $ufw_ssh_port_for_accept +ufw enable +fi + +if [ $first_install = "y" ]; then echo "Configuring firstinstall config" apt install postgresql postgresql-contrib -y pg_ctlcluster 12 main start @@ -95,8 +101,30 @@ echo "auth_backend = postgresql" >> /home/minetest/.minetest/worlds/world/world. echo "pgsql_connection = host=127.0.0.1 user=minetest password=$psql_minetest_user_password dbname=minetest" >> /home/minetest/.minetest/worlds/world/world.mt echo "pgsql_player_connection = host=127.0.0.1 user=minetest password=$psql_minetest_user_password dbname=minetest_players" >> /home/minetest/.minetest/worlds/world/world.mt echo "pgsql_auth_connection = host=127.0.0.1 user=minetest password=$psql_minetest_user_password dbname=minetest_auth" >> /home/minetest/.minetest/worlds/world/world.mt + +echo "disable_fire = true" >> /home/minetest/.minetest/minetest.conf +echo "disable_tnt = true" >> /home/minetest/.minetest/minetest.conf +echo "server_name = "$mt_server_name"" >> /home/minetest/.minetest/minetest.conf +echo "server_description = "$mt_server_description"" >> /home/minetest/.minetest/minetest.conf +echo "server_address = "$mt_server_address"" >> /home/minetest/.minetest/minetest.conf +echo "server_url = "$mt_server_url"" >> /home/minetest/.minetest/minetest.conf +echo "server_announce = "$mt_server_announce"" >> /home/minetest/.minetest/minetest.conf +echo "ipv6_server = "$mt_ipv6_server"" >> /home/minetest/.minetest/minetest.conf +echo "default_game = minetest" >> /home/minetest/.minetest/minetest.conf +echo "motd = "$mt_motd"" >> /home/minetest/.minetest/minetest.conf +echo "max_users = "$mt_max_users"" >> /home/minetest/.minetest/minetest.conf +echo "name = "$mt_admin"" >> /home/minetest/.minetest/minetest.conf +echo "language = "$mt_language"" >> /home/minetest/.minetest/minetest.conf +echo "port = "$mt_port"" >> /home/minetest/.minetest/minetest.conf +echo "enable_rollback_recording = "$mt_enable_rollback_recording"" >> /home/minetest/.minetest/minetest.conf +echo "default_privs = "$mt_default_privs"" >> /home/minetest/.minetest/minetest.conf echo "Fix privileges on /home/minetest" chown minetest:minetest /home/minetest/ -cR + +if [ $ufw_enable = "y" ]; then +ufw allow proto udp from any port $mt_port +fi + fi systemctl start minetestsrv systemctl enable minetestsrv diff --git a/test b/test new file mode 100644 index 00000000..fb2a87e1 --- /dev/null +++ b/test @@ -0,0 +1,16 @@ +echo "disable_fire = true >> /home/minetest/.minetest/minetest.conf +echo "disable_tnt = true >> /home/minetest/.minetest/minetest.conf +echo "server_name = "$mt_server_name" >> /home/minetest/.minetest/minetest.conf +echo "server_description = "$mt_server_description" >> /home/minetest/.minetest/minetest.conf +echo "server_address = "$mt_server_address" >> /home/minetest/.minetest/minetest.conf +echo "server_url = "$mt_server_url" >> /home/minetest/.minetest/minetest.conf +echo "server_announce = "$mt_server_announce" >> /home/minetest/.minetest/minetest.conf +echo "ipv6_server = "$mt_ipv6_server" >> /home/minetest/.minetest/minetest.conf +echo "default_game = minetest >> /home/minetest/.minetest/minetest.conf +echo "motd = "$mt_motd" >> /home/minetest/.minetest/minetest.conf +echo "max_users = "$mt_max_users" >> /home/minetest/.minetest/minetest.conf +echo "name = "$mt_admin" >> /home/minetest/.minetest/minetest.conf +echo "language = "$mt_language" >> /home/minetest/.minetest/minetest.conf +echo "port = "$mt_port" >> /home/minetest/.minetest/minetest.conf +echo "enable_rollback_recording = "$mt_enable_rollback_recording" >> /home/minetest/.minetest/minetest.conf +echo "default_privs = "$mt_default_privs" >> /home/minetest/.minetest/minetest.conf