summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDian Fay2016-09-24 12:11:21 -0400
committerDian Fay2016-09-24 12:11:21 -0400
commitf49468468dfdba04a6c6a28d50eefdb3bb72e02a (patch)
tree2754cf2c4bc7ac440d185cd97fb9950bafcbde1b
parent0c38879172d3d30cb9888dae3692e27dbc33c249 (diff)
downloadaur-f49468468dfdba04a6c6a28d50eefdb3bb72e02a.tar.gz
more flexibility with mapfiles
-rw-r--r--PKGBUILD2
-rw-r--r--README.md4
-rwxr-xr-xdom428
3 files changed, 26 insertions, 8 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 3e6894b0dcd..96db869ab48 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -32,5 +32,5 @@ md5sums=('d8e3011dfa108d3f1574c57aefcecb32'
'7e51badb10054709bbec60bfcbf424ee'
'e9772a237cc540558e74235b98df8a7f'
'338b8462868ecf6cc56c4a520cea6bac'
- '99cdd4c32d1737b03cf8f55758d918ec'
+ '17d227cbd6c5b620b7cf2c07aba37b31'
'22bdb16a296d12c51988c43c3218201b')
diff --git a/README.md b/README.md
index f88bc11aab6..cdcb54b4a2e 100644
--- a/README.md
+++ b/README.md
@@ -32,11 +32,11 @@ If your computer is behind a router you will need to make sure the port is forwa
## Game Configuration
-Your game configuration is stored in key=value format in a properties file. Copy `default.properties` to a safe location and edit as needed. `mapfile` should reference the filename of a map in *your* `~/dominions4/maps` directory. Once ready:
+Your game configuration is stored in key=value format in a properties file. Copy `default.properties` to a safe location and edit as needed. `mapfile` should reference the filename of a map either in the same location as the properties file or in *your* `~/dominions4/maps` directory. Once ready:
1. `sudo dom4 config mygame.properties` loads your config into the server and sets the current game name.
1. `sudo systemctl start dom4-server` starts the server in pretender upload mode.
-1. If `uploadmaxp` or `uploadtime` are set in your configuration, you're done: the game will start automatically when the appropriate limit is reached. If not, wait for everyone to upload their pretenders and then bring the server down with `systemctl stop dom4-server`.
+1. If `uploadmaxp` or `uploadtime` are set in your configuration, you're done: the game will start automatically when the appropriate limit is reached. If not, wait for everyone to upload their pretenders and then bring the server down with `sudo systemctl stop dom4-server`.
1. `sudo dom4 ready` sets the server up to host the last configured game, or you can pass in the name of another properties file (without the extension) after all pretenders have been uploaded.
1. Restart the server using `sudo systemctl start dom4-server` again to begin the game.
diff --git a/dom4 b/dom4
index 8f04edc96d2..fb7089b6b5e 100755
--- a/dom4
+++ b/dom4
@@ -15,19 +15,37 @@ function config {
fi
fi
- echo "Copying properties file"
+ echo "Copying properties file..."
cp $1 /usr/share/dom4/config
mapfile=$(grep -oP "mapfile\s+\K.+" $1)
mapname=$(basename $mapfile .map)
+ confdir=$(dirname $1)
- echo "Copying $mapname map files"
+ echo "Looking for $mapname map files..."
mkdir -p /usr/share/dom4/maps
USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6)
- cp "$USER_HOME/dominions4/maps/$mapname."* /usr/share/dom4/maps
+
+ if [[ -s "$mapname.map" ]]; then
+ echo "Copying $mapname map files"
+
+ cp "$mapname".* /usr/share/dom4/maps
+ elif [[ -s "$confdir/$mapname".map ]]; then
+ echo "Copying $mapname map files from $confdir"
+
+ cp "$confdir/$mapname".* /usr/share/dom4/maps
+ elif [[ -s "$USER_HOME/dominions4/maps/$mapname".map ]]; then
+ echo "Copying $mapname map files from $USER_HOME/dominions4/maps"
+
+ cp "$USER_HOME/dominions4/maps/$mapname".* /usr/share/dom4/maps
+ else
+ echo "Could not find $mapname.map in $(pwd) or $USER_HOME/dominions4/maps. Please ensure the map file(s) exist and try again."
+
+ exit 1;
+ fi
# Set name as current hosted game
echo $(basename $1 .properties) > /usr/share/dom4/current
@@ -121,13 +139,13 @@ case $1 in
delete "${@:2}"
;;
- "")
+ *)
cat <<EOF
Get an example template to modify in your editor of choice:
cp /usr/share/dom4/config/default.properties mygame.properties
-Load a game config file:
+Load a properties file into the server and set it as the current game:
sudo dom4 config path/to/mygame.properties