diff --git a/SOURCES/Makefile b/SOURCES/Makefile index f3dad78..978de29 100644 --- a/SOURCES/Makefile +++ b/SOURCES/Makefile @@ -112,7 +112,9 @@ install: filesystem build install -m 644 $(RELEASEDIR)/main/lib/* $(SCRIPTLIBDIR) install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)@.service $(UNITDIR) + install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-orig@.service $(UNITDIR) install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-beta@.service $(UNITDIR) + install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-beta-orig@.service $(UNITDIR) install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.service $(UNITDIR) install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer $(UNITDIR) install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-update.service $(UNITDIR) @@ -135,7 +137,9 @@ uninstall: rm -f $(BINDIR)/$(NAME)-beta rm -f $(UNITDIR)/$(NAME)@.service + rm -f $(UNITDIR)/$(NAME)-orig@.service rm -f $(UNITDIR)/$(NAME)-beta@.service + rm -f $(UNITDIR)/$(NAME)-beta-orig@.service rm -f $(UNITDIR)/$(NAME)-beta-update.service rm -f $(UNITDIR)/$(NAME)-beta-update.timer rm -f $(UNITDIR)/$(NAME)-update.service @@ -154,7 +158,9 @@ test: fake-systemd-build $(XMLCHECK) $(RELEASEDIR)/main/firewalld/$(NAME).xml $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)@.service + $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-orig@.service $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta@.service + $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-orig@.service $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.service $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.service diff --git a/SOURCES/main/kf2-srv b/SOURCES/main/kf2-srv index 2dc5546..3b858cc 100755 --- a/SOURCES/main/kf2-srv +++ b/SOURCES/main/kf2-srv @@ -29,6 +29,7 @@ readonly PatchDir=":DEFINE_PREFIX:/share/kf2-srv/patch" readonly InstallDir=":DEFINE_PREFIX:/games/kf2-srv${KF2POSTFIX}" readonly AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64" +readonly AppBinOrig="${AppBin}.orig" readonly DefaultConfigDir="$InstallDir/KFGame/Config" readonly DefaultDownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop" diff --git a/SOURCES/main/lib/game.lib b/SOURCES/main/lib/game.lib index 6021bc8..5b0ea39 100644 --- a/SOURCES/main/lib/game.lib +++ b/SOURCES/main/lib/game.lib @@ -281,7 +281,7 @@ function make_default_instance () # $1: Dir function apply_patch () { if [[ -x "$PatchDir/kf2-ranked-patch" ]]; then - "$PatchDir/kf2-ranked-patch" "$AppBin" + "$PatchDir/kf2-ranked-patch" "$AppBin" "$AppBinOrig" fi } diff --git a/SOURCES/main/lib/instance.lib b/SOURCES/main/lib/instance.lib index 9f0d947..9ac340d 100644 --- a/SOURCES/main/lib/instance.lib +++ b/SOURCES/main/lib/instance.lib @@ -45,6 +45,21 @@ function service_name () # $*: Instance[s] local Services="" for Instance in $* do + if multini -g "$InstanceConfigDir/$Instance" '' "UseOrigApp" 2> /dev/null | grep -Piqo '^True$' && test -x "$AppBinOrig" + Services+=" kf2-srv${KF2POSTFIX}-orig@$Instance.service" + else + Services+=" kf2-srv${KF2POSTFIX}@$Instance.service" + fi + done + echo "$Services" +} + +function service_names () # $*: Instance[s] +{ + local Services="" + for Instance in $* + do + Services+=" kf2-srv${KF2POSTFIX}-orig@$Instance.service" Services+=" kf2-srv${KF2POSTFIX}@$Instance.service" done echo "$Services" @@ -212,7 +227,7 @@ function instance_disable () # $*: [InstanceName[s]] done if [[ -n "$ToDisableInstanceList" ]]; then - systemctl disable $(service_name "$ToDisableInstanceList") + systemctl disable $(service_names "$ToDisableInstanceList") else echo "Nothing to do" fi @@ -409,7 +424,7 @@ function instance_stop () # $*: [InstanceName[s]] done if [[ -n "$ToStopInstanceList" ]]; then - systemctl stop $(service_name "$ToStopInstanceList") + systemctl stop $(service_names "$ToStopInstanceList") else echo "Nothing to do" fi diff --git a/SOURCES/main/systemd/kf2-srv-beta-orig@.service b/SOURCES/main/systemd/kf2-srv-beta-orig@.service new file mode 100644 index 0000000..72078a9 --- /dev/null +++ b/SOURCES/main/systemd/kf2-srv-beta-orig@.service @@ -0,0 +1,25 @@ +[Unit] +Description=Killing Floor 2 Beta Server Daemon - %i +Conflicts=kf2-srv-beta@%i.service +After=network-online.target +Wants=network-online.target + +[Service] +User=steam +Group=steam +Type=simple +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=kf2-srv-beta/%i +EnvironmentFile=/etc/kf2-srv/instances-beta/%i/instance.conf +ExecStart=:DEFINE_PREFIX:/games/kf2-srv-beta/Binaries/Win64/KFGameSteamServer.bin.x86_64.orig ${Map}?Difficulty=${Difficulty}?GameLength=${Length}?Game=${Game}?Mutator=${Mutators}?${Args} configsubdir=instances/%i -webadminport=${PortWeb} -queryport=${PortQuery} -port=${PortGame} +Restart=on-failure + +NoNewPrivileges=yes +PrivateTmp=true +PrivateDevices=true +ProtectHome=true +ProtectSystem=false + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/main/systemd/kf2-srv-beta@.service b/SOURCES/main/systemd/kf2-srv-beta@.service index 6f9d1c2..cc50e6e 100644 --- a/SOURCES/main/systemd/kf2-srv-beta@.service +++ b/SOURCES/main/systemd/kf2-srv-beta@.service @@ -1,5 +1,6 @@ [Unit] Description=Killing Floor 2 Beta Server Daemon - %i +Conflicts=kf2-srv-beta-orig@%i.service After=network-online.target Wants=network-online.target diff --git a/SOURCES/main/systemd/kf2-srv-orig@.service b/SOURCES/main/systemd/kf2-srv-orig@.service new file mode 100644 index 0000000..b5aa763 --- /dev/null +++ b/SOURCES/main/systemd/kf2-srv-orig@.service @@ -0,0 +1,25 @@ +[Unit] +Description=Killing Floor 2 Server Daemon - %i +Conflicts=kf2-srv@%i.service +After=network-online.target +Wants=network-online.target + +[Service] +User=steam +Group=steam +Type=simple +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=kf2-srv/%i +EnvironmentFile=/etc/kf2-srv/instances/%i/instance.conf +ExecStart=:DEFINE_PREFIX:/games/kf2-srv/Binaries/Win64/KFGameSteamServer.bin.x86_64.orig ${Map}?Difficulty=${Difficulty}?GameLength=${Length}?Game=${Game}?Mutator=${Mutators}?${Args} configsubdir=instances/%i -webadminport=${PortWeb} -queryport=${PortQuery} -port=${PortGame} +Restart=on-failure + +NoNewPrivileges=yes +PrivateTmp=true +PrivateDevices=true +ProtectHome=true +ProtectSystem=false + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/main/systemd/kf2-srv@.service b/SOURCES/main/systemd/kf2-srv@.service index 22f030d..c4bc691 100644 --- a/SOURCES/main/systemd/kf2-srv@.service +++ b/SOURCES/main/systemd/kf2-srv@.service @@ -1,5 +1,6 @@ [Unit] Description=Killing Floor 2 Server Daemon - %i +Conflicts=kf2-srv-orig@%i.service After=network-online.target Wants=network-online.target