2020-10-25 13:07:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
source config-file
|
|
|
|
|
|
|
|
echo "Stop minetestsrv service"
|
|
|
|
systemctl stop minetestsrv
|
|
|
|
|
|
|
|
echo "Drop and recreate all databases"
|
|
|
|
sudo -u postgres dropdb minetest
|
|
|
|
sudo -u postgres dropdb minetest_players
|
|
|
|
sudo -u postgres dropdb minetest_auth
|
|
|
|
sudo -u postgres createdb minetest
|
|
|
|
sudo -u postgres createdb minetest_players
|
|
|
|
sudo -u postgres createdb minetest_auth
|
|
|
|
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password '$psql_postgres_user_password';"
|
|
|
|
sudo -u postgres psql -U postgres -d postgres -c "alter user minetest with password '$psql_minetest_user_password';"
|
|
|
|
|
|
|
|
sudo -u postgres psql -U postgres -d postgres -c "grant all privileges on database "minetest" to minetest;"
|
|
|
|
sudo -u postgres psql -U postgres -d postgres -c "grant all privileges on database "minetest_players" to minetest;"
|
|
|
|
sudo -u postgres psql -U postgres -d postgres -c "grant all privileges on database "minetest_auth" to minetest;"
|
|
|
|
|
2020-10-25 17:13:25 +01:00
|
|
|
echo "Backup minetest.conf"
|
2020-10-25 13:07:02 +01:00
|
|
|
mv -f /home/minetest/.minetest/minetest.conf /tmp/minetest.conf
|
|
|
|
|
2020-10-25 17:13:25 +01:00
|
|
|
echo "Remove /home/minetest"
|
2020-10-25 13:07:02 +01:00
|
|
|
rm -rf /home/minetest
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
echo "Clone minetest_game $mt_game_version"
|
2020-10-25 13:07:02 +01:00
|
|
|
mkdir -p /home/minetest/.minetest/games/
|
|
|
|
rm -rf /home/minetest/.minetest/games/minetest
|
2024-12-19 12:55:40 +01:00
|
|
|
git clone --depth 1 --branch "$mt_game_version" https://github.com/minetest/minetest_game.git /home/minetest/.minetest/games/minetest
|
2020-10-25 13:07:02 +01:00
|
|
|
|
2020-10-25 17:13:25 +01:00
|
|
|
echo "Restore minetest.conf and regenerate world.mt"
|
2020-10-25 16:58:28 +01:00
|
|
|
mkdir -p /home/minetest/.minetest/worlds/world/
|
2020-10-25 13:07:02 +01:00
|
|
|
mv -f /tmp/minetest.conf /home/minetest/.minetest/minetest.conf
|
2020-10-25 17:13:25 +01:00
|
|
|
|
|
|
|
echo "gameid = minetest" > /home/minetest/.minetest/worlds/world/world.mt
|
|
|
|
echo "backend = postgresql" >> /home/minetest/.minetest/worlds/world/world.mt
|
2021-03-17 09:49:19 +01:00
|
|
|
echo "creative_mode = $mt_creative_mode" >> /home/minetest/.minetest/worlds/world/world.mt
|
2020-10-25 17:13:25 +01:00
|
|
|
echo "enable_damage = true" >> /home/minetest/.minetest/worlds/world/world.mt
|
|
|
|
echo "player_backend = postgresql" >> /home/minetest/.minetest/worlds/world/world.mt
|
|
|
|
echo "auth_backend = postgresql" >> /home/minetest/.minetest/worlds/world/world.mt
|
|
|
|
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
|
2020-10-25 13:07:02 +01:00
|
|
|
|
2020-10-25 20:59:37 +01:00
|
|
|
cat mods-list >> /home/minetest/.minetest/worlds/world/world.mt
|
|
|
|
|
2020-10-25 21:06:31 +01:00
|
|
|
echo "Copy mods folder"
|
|
|
|
cp -r mods /home/minetest/.minetest/mods
|
|
|
|
|
2020-10-25 13:07:02 +01:00
|
|
|
echo "Fix privileges on /home/minetest"
|
|
|
|
chown minetest:minetest /home/minetest/ -cR
|
|
|
|
|