More support for patched app

This commit is contained in:
GenZmeY 2021-02-23 19:21:54 +03:00
parent 7a3eb21954
commit d5e1768633
8 changed files with 77 additions and 3 deletions

View File

@ -112,7 +112,9 @@ install: filesystem build
install -m 644 $(RELEASEDIR)/main/lib/* $(SCRIPTLIBDIR) install -m 644 $(RELEASEDIR)/main/lib/* $(SCRIPTLIBDIR)
install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)@.service $(UNITDIR) 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@.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.service $(UNITDIR)
install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer $(UNITDIR) install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer $(UNITDIR)
install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-update.service $(UNITDIR) install -m 644 $(RELEASEDIR)/main/systemd/$(NAME)-update.service $(UNITDIR)
@ -135,7 +137,9 @@ uninstall:
rm -f $(BINDIR)/$(NAME)-beta rm -f $(BINDIR)/$(NAME)-beta
rm -f $(UNITDIR)/$(NAME)@.service rm -f $(UNITDIR)/$(NAME)@.service
rm -f $(UNITDIR)/$(NAME)-orig@.service
rm -f $(UNITDIR)/$(NAME)-beta@.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.service
rm -f $(UNITDIR)/$(NAME)-beta-update.timer rm -f $(UNITDIR)/$(NAME)-beta-update.timer
rm -f $(UNITDIR)/$(NAME)-update.service rm -f $(UNITDIR)/$(NAME)-update.service
@ -154,7 +158,9 @@ test: fake-systemd-build
$(XMLCHECK) $(RELEASEDIR)/main/firewalld/$(NAME).xml $(XMLCHECK) $(RELEASEDIR)/main/firewalld/$(NAME).xml
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)@.service $(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@.service
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-orig@.service
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.service $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.service
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.service $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.service

View File

@ -29,6 +29,7 @@ readonly PatchDir=":DEFINE_PREFIX:/share/kf2-srv/patch"
readonly InstallDir=":DEFINE_PREFIX:/games/kf2-srv${KF2POSTFIX}" readonly InstallDir=":DEFINE_PREFIX:/games/kf2-srv${KF2POSTFIX}"
readonly AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64" readonly AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64"
readonly AppBinOrig="${AppBin}.orig"
readonly DefaultConfigDir="$InstallDir/KFGame/Config" readonly DefaultConfigDir="$InstallDir/KFGame/Config"
readonly DefaultDownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop" readonly DefaultDownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop"

View File

@ -281,7 +281,7 @@ function make_default_instance () # $1: Dir
function apply_patch () function apply_patch ()
{ {
if [[ -x "$PatchDir/kf2-ranked-patch" ]]; then if [[ -x "$PatchDir/kf2-ranked-patch" ]]; then
"$PatchDir/kf2-ranked-patch" "$AppBin" "$PatchDir/kf2-ranked-patch" "$AppBin" "$AppBinOrig"
fi fi
} }

View File

@ -45,6 +45,21 @@ function service_name () # $*: Instance[s]
local Services="" local Services=""
for Instance in $* for Instance in $*
do 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" Services+=" kf2-srv${KF2POSTFIX}@$Instance.service"
done done
echo "$Services" echo "$Services"
@ -212,7 +227,7 @@ function instance_disable () # $*: [InstanceName[s]]
done done
if [[ -n "$ToDisableInstanceList" ]]; then if [[ -n "$ToDisableInstanceList" ]]; then
systemctl disable $(service_name "$ToDisableInstanceList") systemctl disable $(service_names "$ToDisableInstanceList")
else else
echo "Nothing to do" echo "Nothing to do"
fi fi
@ -409,7 +424,7 @@ function instance_stop () # $*: [InstanceName[s]]
done done
if [[ -n "$ToStopInstanceList" ]]; then if [[ -n "$ToStopInstanceList" ]]; then
systemctl stop $(service_name "$ToStopInstanceList") systemctl stop $(service_names "$ToStopInstanceList")
else else
echo "Nothing to do" echo "Nothing to do"
fi fi

View File

@ -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

View File

@ -1,5 +1,6 @@
[Unit] [Unit]
Description=Killing Floor 2 Beta Server Daemon - %i Description=Killing Floor 2 Beta Server Daemon - %i
Conflicts=kf2-srv-beta-orig@%i.service
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target

View File

@ -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

View File

@ -1,5 +1,6 @@
[Unit] [Unit]
Description=Killing Floor 2 Server Daemon - %i Description=Killing Floor 2 Server Daemon - %i
Conflicts=kf2-srv-orig@%i.service
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target