summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDian Fay2016-10-23 22:48:03 -0400
committerDian Fay2016-10-23 22:48:03 -0400
commit7adcf7cb7b3655648a2f97393401d4a16ce477fd (patch)
tree994e6b522384124b45974f3037f044adc86a32b4
parent890a0a33954eda28d1ac0af5a6210b9631c2f8b8 (diff)
downloadaur-7adcf7cb7b3655648a2f97393401d4a16ce477fd.tar.gz
better sanity checking, 1.1.3
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD6
-rwxr-xr-xdom447
3 files changed, 33 insertions, 26 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 61c9064f8b0..7106c67929f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = dom4-server
pkgdesc = Configure and run Dominions 4 as a headless server
- pkgver = 1.1.2
+ pkgver = 1.1.3
pkgrel = 1
url = http://www.illwinter.com/dom4/
install = dom4-server.install
@@ -12,11 +12,11 @@ pkgbase = dom4-server
source = dom4-sysusers.conf
source = dom4-tmpfile.conf
source = dom4
- md5sums = 03931b9317799ef4ae7fded185cd1c69
+ md5sums = 372f6150c891165d1c1dc3a26477c7de
md5sums = d7467fb7a599236f71d428a85cf05014
md5sums = e9772a237cc540558e74235b98df8a7f
md5sums = 338b8462868ecf6cc56c4a520cea6bac
- md5sums = c120fdb1e6673b1bfc2f65204ac66ea1
+ md5sums = ed40151150be520c7d903d35e2649789
pkgname = dom4-server
diff --git a/PKGBUILD b/PKGBUILD
index 6a69d91c76f..9e23ceb1c64 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Dominions 4 Server Configuration
# Maintainer: Dian Fay <dian.m.fay@gmail.com>
pkgname=dom4-server
-pkgver=1.1.2
+pkgver=1.1.3
pkgrel=1
pkgdesc="Configure and run Dominions 4 as a headless server"
arch=("x86_64")
@@ -26,8 +26,8 @@ package() {
install -Dm644 "$srcdir/dom4-sysusers.conf" "$pkgdir/usr/lib/sysusers.d/dom4.conf"
install -Dm644 "$srcdir/dom4-tmpfile.conf" "$pkgdir/usr/lib/tmpfiles.d/dom4.conf"
}
-md5sums=('03931b9317799ef4ae7fded185cd1c69'
+md5sums=('372f6150c891165d1c1dc3a26477c7de'
'd7467fb7a599236f71d428a85cf05014'
'e9772a237cc540558e74235b98df8a7f'
'338b8462868ecf6cc56c4a520cea6bac'
- 'c120fdb1e6673b1bfc2f65204ac66ea1')
+ 'ed40151150be520c7d903d35e2649789')
diff --git a/dom4 b/dom4
index 470cb8f998b..25428eabed9 100755
--- a/dom4
+++ b/dom4
@@ -62,12 +62,14 @@ EOF
fi
if [[ -s "/usr/share/dom4/config/$1.properties" ]]; then
- read -r -n 2 -p "$1 is already configured. Overwrite? [Y/n] " ovr
+ read -r -n 2 -p "$1 is already configured. Edit this game? [Y/n] " ovr
if [[ $ovr != Y ]]; then
exit 0
fi
+
echo
else
+ newgame=true
cat << EOF | sudo -u dom4 tee /usr/share/dom4/config/$1.properties > /dev/null
# See http://www.illwinter.com/dom4/startoptions.pdf for a full reference.
# Sections 3-5, 3-6, and 3-7 are especially relevant. Switches should be
@@ -105,26 +107,27 @@ EOF
mapfile=$(grep -oP "^mapfile\s+\K.+" /usr/share/dom4/config/$1.properties)
mapname=$(basename $mapfile .map)
- if [[ -s "$mapname.map" ]]; then
- echo "Copying $mapname map files..."
+ if [ "$newgame" = true ]; then
+ if [[ -s "$mapname.map" ]]; then
+ echo "Copying $mapname map files..."
- sudo cp "$mapname".* /usr/share/dom4/maps
- elif [[ -s "$HOME/dominions4/maps/$mapname".map ]]; then
- echo "Copying $mapname map files from $HOME/dominions4/maps..."
+ sudo cp "$mapname".* /usr/share/dom4/maps
+ elif [[ -s "$HOME/dominions4/maps/$mapname".map ]]; then
+ echo "Copying $mapname map files from $HOME/dominions4/maps..."
- sudo cp "$HOME/dominions4/maps/$mapname".* /usr/share/dom4/maps
- else
- echo "Could not find $mapname.map in $(pwd) or $HOME/dominions4/maps. Please ensure the map file(s) exist in one or the other location and try again."
+ sudo cp "$HOME/dominions4/maps/$mapname".* /usr/share/dom4/maps
+ else
+ echo "Could not find $mapname.map in $(pwd) or $HOME/dominions4/maps. Please ensure the map file(s) exist in one or the other location and try again."
- exit 1;
- fi
+ exit 1;
+ fi
- echo
+ echo
+ fi
change $1
cat <<EOF
-
Done. Start the service to let players upload their pretenders.
sudo systemctl start dom4-server.service
@@ -195,20 +198,24 @@ function delete {
exit 0
fi
- game=$(</usr/share/dom4/current)
+ if [[ -s /usr/share/dom4/current ]]; then
+ game=$(</usr/share/dom4/current)
- if [[ $game = $1 ]]; then
- read -r -n 2 -p "$game is currently being hosted. Really delete? [Y/n] " ovr
- if [[ $ovr != Y ]]; then
- exit 0
- fi
+ if [[ $game = $1 ]]; then
+ read -r -n 2 -p "$game is currently being hosted. Really delete? [Y/n] " ovr
+ if [[ $ovr != Y ]]; then
+ exit 0
+ fi
- sudo -u dom4 rm /usr/share/dom4/current
+ sudo -u dom4 rm /usr/share/dom4/current
+ fi
fi
# leave the mapfile in case something else is using it
sudo -u dom4 rm /usr/share/dom4/config/$1.properties
sudo -u dom4 rm -rf /usr/share/dom4/savedgames/$1
+
+ echo "Deleted $1."
}
case $1 in