run.sh 648 B

12345678910111213141516171819
  1. #!/bin/bash -e
  2. world=$(mktemp -d)
  3. trap 'rm -rf "$world" || :' EXIT
  4. [ -f game.conf ] || { echo "Must be run in game root folder." >&2; exit 1; }
  5. chmod -R 777 "$world" # container uses unprivileged user inside
  6. vol=(
  7. -v "$PWD/utils/test/minetest.conf":/etc/minetest/minetest.conf
  8. --tmpfs /var/lib/minetest/.minetest
  9. -v "$PWD":/var/lib/minetest/.minetest/games/minetest_game
  10. -v "$world":/var/lib/minetest/.minetest/world
  11. )
  12. [ -z "$DOCKER_IMAGE" ] && DOCKER_IMAGE="ghcr.io/minetest/minetest:master"
  13. docker run --rm -i "${vol[@]}" "$DOCKER_IMAGE" --config /etc/minetest/minetest.conf --gameid minetest
  14. test -f "$world/map.sqlite" || exit 1
  15. exit 0