summarylogtreecommitdiffstats
path: root/dom4-server
blob: ecfb613af4526a718c0b515f7397acf116f202ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

if [[ ! -s /usr/share/dom4/current ]]; then
  echo "No game configured. Use 'dom4 config' to set up a game."
  exit 1
fi

game=$(</usr/share/dom4/current)

if [[ ! -s /usr/share/dom4/config/$game.properties ]]; then
  echo "Tried to load $game but configuration file is missing."
  exit 1
fi

# Load config

config="--tcpserver --textonly --noclientstart"

while read -r line; do
  if [[ -n $line && ! $line = \#* ]]; then
    echo "Setting $line"

    config="$config --$line"
  fi
done < /usr/share/dom4/config/$game.properties

# Start server

export DOM4_CONF=/usr/share/dom4

exec sh /opt/dom4/dom4.sh $config $game > /var/log/dom4/dom4.log