binary patching support

This commit is contained in:
GenZmeY 2021-02-22 12:57:13 +03:00
parent b660c5f1b0
commit 7a3eb21954
6 changed files with 39 additions and 24 deletions

View File

@ -43,6 +43,7 @@ DATADIR = $(DESTDIR)$(PREFIX)/share
SCRIPTDIR = $(DATADIR)/$(NAME)
SCRIPTGRPDIR = $(SCRIPTDIR)/cmdgrp
SCRIPTLIBDIR = $(SCRIPTDIR)/lib
SCRIPTPATCHDIR = $(SCRIPTDIR)/patch
LICENSEDIR = $(DATADIR)/licenses/$(NAME)
KF2MAINDIR = $(GAMEDIR)/$(NAME)
KF2BETADIR = $(GAMEDIR)/$(NAME)-beta
@ -69,25 +70,26 @@ fake-systemd-build:
find $(RELEASEDIR) -type f -exec sed -i -r 's|ExecStart=.+KFGameSteamServer.bin.x86_64|ExecStart=/bin/bash|g;' {} \;
filesystem:
test -d '$(CONFDIR)' || install -m 775 -d '$(CONFDIR)'
test -d '$(INSTMAINDIR)' || install -m 775 -d '$(INSTMAINDIR)'
test -d '$(INSTBETADIR)' || install -m 775 -d '$(INSTBETADIR)'
test -d '$(MAPCYCLEDIR)' || install -m 775 -d '$(MAPCYCLEDIR)'
test -d '$(CACHEDIR)' || install -m 775 -d '$(CACHEDIR)'
test -d '$(BINDIR)' || install -m 755 -d '$(BINDIR)'
test -d '$(SBINDIR)' || install -m 755 -d '$(SBINDIR)'
test -d '$(KF2MAINDIR)' || install -m 775 -d '$(KF2MAINDIR)'
test -d '$(KF2BETADIR)' || install -m 775 -d '$(KF2BETADIR)'
test -d '$(LICENSEDIR)' || install -m 755 -d '$(LICENSEDIR)'
test -d '$(MAINLOGDIR)' || install -m 770 -d '$(MAINLOGDIR)'
test -d '$(BETALOGDIR)' || install -m 770 -d '$(BETALOGDIR)'
test -d '$(UNITDIR)' || install -m 755 -d '$(UNITDIR)'
test -d '$(FIREWALLDDIR)' || install -m 755 -d '$(FIREWALLDDIR)'
test -d '$(LOGROTATEDIR)' || install -m 755 -d '$(LOGROTATEDIR)'
test -d '$(RSYSLOGDIR)' || install -m 755 -d '$(RSYSLOGDIR)'
test -d '$(SCRIPTGRPDIR)' || install -m 755 -d '$(SCRIPTGRPDIR)'
test -d '$(SCRIPTLIBDIR)' || install -m 755 -d '$(SCRIPTLIBDIR)'
test -d '$(BASHCOMPDIR)' || install -m 755 -d '$(BASHCOMPDIR)'
test -d '$(CONFDIR)' || install -m 775 -d '$(CONFDIR)'
test -d '$(INSTMAINDIR)' || install -m 775 -d '$(INSTMAINDIR)'
test -d '$(INSTBETADIR)' || install -m 775 -d '$(INSTBETADIR)'
test -d '$(MAPCYCLEDIR)' || install -m 775 -d '$(MAPCYCLEDIR)'
test -d '$(CACHEDIR)' || install -m 775 -d '$(CACHEDIR)'
test -d '$(BINDIR)' || install -m 755 -d '$(BINDIR)'
test -d '$(SBINDIR)' || install -m 755 -d '$(SBINDIR)'
test -d '$(KF2MAINDIR)' || install -m 775 -d '$(KF2MAINDIR)'
test -d '$(KF2BETADIR)' || install -m 775 -d '$(KF2BETADIR)'
test -d '$(LICENSEDIR)' || install -m 755 -d '$(LICENSEDIR)'
test -d '$(MAINLOGDIR)' || install -m 770 -d '$(MAINLOGDIR)'
test -d '$(BETALOGDIR)' || install -m 770 -d '$(BETALOGDIR)'
test -d '$(UNITDIR)' || install -m 755 -d '$(UNITDIR)'
test -d '$(FIREWALLDDIR)' || install -m 755 -d '$(FIREWALLDDIR)'
test -d '$(LOGROTATEDIR)' || install -m 755 -d '$(LOGROTATEDIR)'
test -d '$(RSYSLOGDIR)' || install -m 755 -d '$(RSYSLOGDIR)'
test -d '$(SCRIPTGRPDIR)' || install -m 755 -d '$(SCRIPTGRPDIR)'
test -d '$(SCRIPTLIBDIR)' || install -m 755 -d '$(SCRIPTLIBDIR)'
test -d '$(SCRIPTPATCHDIR)' || install -m 755 -d '$(SCRIPTPATCHDIR)'
test -d '$(BASHCOMPDIR)' || install -m 755 -d '$(BASHCOMPDIR)'
install: filesystem build
install -m 755 $(RELEASEDIR)/main/$(NAME) $(BINDIR)

View File

@ -25,6 +25,7 @@ readonly ScriptVersion=$(rpm -q --queryformat '%{VERSION}' "$ScriptName")
readonly GrpDir=":DEFINE_PREFIX:/share/kf2-srv/cmdgrp"
readonly LibDir=":DEFINE_PREFIX:/share/kf2-srv/lib"
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"

View File

@ -60,6 +60,7 @@ function game_update ()
elif updates_aviable; then
instance_stop
steamcmd +login $SteamLogin +force_install_dir $InstallDir +app_update $AppServerNum $BetaArg +exit
apply_patch
instance_start
else
echo "Server is up to date"
@ -96,6 +97,7 @@ function game_validate ()
fi
instance_stop
steamcmd +login $SteamLogin +force_install_dir $InstallDir +app_update $AppServerNum $BetaArg validate +exit
apply_patch
fix_steamclient_so
instance_start
}
@ -200,6 +202,7 @@ function first_install ()
fix_steamclient_so
ln -s "$InstanceConfigDir" "$DefaultConfigDir/instances"
make_default_instance
apply_patch
echo "KF2 succesfully installed"
}
@ -275,6 +278,13 @@ function make_default_instance () # $1: Dir
fix_ini_eol "$InstanceDir"
}
function apply_patch ()
{
if [[ -x "$PatchDir/kf2-ranked-patch" ]]; then
"$PatchDir/kf2-ranked-patch" "$AppBin"
fi
}
function fix_ini_eol () # $1: Dir
{
find "$1" \( -type l -o -type f \) -name '*.ini' | \

View File

@ -1,6 +1,5 @@
[Unit]
Description=Killing Floor 2 Beta Server Daemon - %i
After=kf2-srv-force-attr.service
After=network-online.target
Wants=network-online.target
@ -13,7 +12,7 @@ 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 ${Map}?Difficulty=${Difficulty}?GameLength=${Length}?Game=${Game}?Mutator=${Mutators}?${Args} configsubdir=instances/%i -webadminport=${PortWeb} -queryport=${PortQuery} -port=${PortGame}
Restart=always
Restart=on-failure
NoNewPrivileges=yes
PrivateTmp=true

View File

@ -1,6 +1,5 @@
[Unit]
Description=Killing Floor 2 Server Daemon - %i
After=kf2-srv-force-attr.service
After=network-online.target
Wants=network-online.target
@ -13,7 +12,7 @@ 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 ${Map}?Difficulty=${Difficulty}?GameLength=${Length}?Game=${Game}?Mutator=${Mutators}?${Args} configsubdir=instances/%i -webadminport=${PortWeb} -queryport=${PortQuery} -port=${PortGame}
Restart=always
Restart=on-failure
NoNewPrivileges=yes
PrivateTmp=true

View File

@ -1,7 +1,7 @@
%global steamuser steam
Name: kf2-srv
Version: 0.16.0
Version: 0.17.0
Release: 1%{dist}
Summary: Killing Floor 2 server
Group: Amusements/Games
@ -68,6 +68,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(0775,root,root) %dir %{_datadir}/%{name}/cmdgrp
%attr(0755,root,root) %dir %{_datadir}/%{name}/cmdgrp/*
%attr(0775,root,root) %dir %{_datadir}/%{name}/lib
%attr(0775,root,root) %dir %{_datadir}/%{name}/patch
%attr(0664,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/instance.conf.template
%attr(0664,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%attr(0640,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/bot.conf
@ -100,6 +101,9 @@ if [[ $1 == 1 ]]; then # Install
fi
%changelog
* Sun Feb 21 2021 GenZmeY <genzmey@gmail.com> - 0.17.0-1
- Binary patching support.
* Mon Sep 21 2020 GenZmeY <genzmey@gmail.com> - 0.16.0-1
- remove force-attr daemon;
- log cmg group;