Docker image which provides a full Eressea installation to host a local game.
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.

62 lines
1.5 KiB

3 weeks ago
3 weeks ago
  1. #!/bin/bash
  2. # this script is based on run-eressea.cron
  3. # differences to original
  4. # it is possible to run a turn with empty orders
  5. eval "$(luarocks path)"
  6. GAME=$1
  7. ENABLE_EMPTY_ORDERS=$2
  8. (
  9. [ "$ENABLED" == "no" ] && exit
  10. [ -z "$ERESSEA" ] && ERESSEA="$HOME/eressea"
  11. export ERESSEA
  12. BIN="$ERESSEA/server/bin"
  13. TURN=$(cat "$ERESSEA/game-$GAME/turn")
  14. if [ ! -e "$ERESSEA/game-$GAME/data/$TURN.dat" ]; then
  15. echo "data file $TURN is missing, cannot run turn for game $GAME"
  16. exit 1
  17. fi
  18. REPORTS="$ERESSEA/game-$GAME/reports"
  19. if [ -d "$REPORTS" ]; then
  20. rm -rf "$REPORTS"
  21. fi
  22. mkdir "$REPORTS"
  23. cd "$ERESSEA/game-$GAME" || exit
  24. if [ -d test ]; then
  25. touch test/execute.lock
  26. fi
  27. "$BIN/create-orders" "$GAME" "$TURN"
  28. if [ ! -s "$ERESSEA/game-$GAME/orders.$TURN" ]; then
  29. if [ "$ENABLE_EMPTY_ORDERS" != "yes" ]; then
  30. echo "server did not create orders for turn $TURN in game $GAME"
  31. exit 2
  32. fi
  33. fi
  34. "$BIN/backup-eressea" "$GAME" "$TURN"
  35. rm -f execute.lock
  36. "$BIN/run-turn" "$GAME" "$TURN"
  37. touch execute.lock
  38. if [ ! -s "$REPORTS/reports.txt" ]; then
  39. echo "server did not create reports.txt in game $GAME"
  40. exit 4
  41. fi
  42. "$BIN/backup-eressea" "$GAME" "$TURN"
  43. let TURN=$TURN+1
  44. if [ ! -s "$ERESSEA/game-$GAME/data/$TURN.dat" ]; then
  45. echo "server did not create data for turn $TURN in game $GAME"
  46. exit 3
  47. fi
  48. echo "sending reports for game $GAME, turn $TURN"
  49. "$BIN/compress.sh" "$GAME" "$TURN"
  50. "$BIN/sendreports.sh" "$GAME"
  51. "$BIN/backup-eressea" "$GAME" "$TURN"
  52. rm -f test/execute.lock
  53. ) | tee -a "$HOME/log/eressea.cron.log"