Wed Jul 8 2020
This commit is contained in:
parent
d44aa8e270
commit
3eb78094ea
26
SOURCES/kf2-srv
Executable file → Normal file
26
SOURCES/kf2-srv
Executable file → Normal file
@ -29,7 +29,7 @@ source /etc/kf2-srv/kf2-srv.conf
|
|||||||
|
|
||||||
ScriptFullname=$(readlink -e "$0")
|
ScriptFullname=$(readlink -e "$0")
|
||||||
ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
|
ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
|
||||||
readonly ScriptVersion="0.10.1"
|
readonly ScriptVersion="0.11.0"
|
||||||
|
|
||||||
# Constants. Don't change.
|
# Constants. Don't change.
|
||||||
readonly AppServerNum="232130"
|
readonly AppServerNum="232130"
|
||||||
@ -247,6 +247,16 @@ function new_instance () # $*: InstanceName[s]
|
|||||||
multini -s "$InstanceDir/main.conf" '' 'PortQuery' "$MaxQueryPort"
|
multini -s "$InstanceDir/main.conf" '' 'PortQuery' "$MaxQueryPort"
|
||||||
multini -s "$InstanceDir/main.conf" '' 'PortWeb' "$MaxWebAdminPort"
|
multini -s "$InstanceDir/main.conf" '' 'PortWeb' "$MaxWebAdminPort"
|
||||||
|
|
||||||
|
multini -s "$InstanceDir/KFWeb.ini" "IpDrv.WebServer" "bEnabled" "true"
|
||||||
|
multini -s "$InstanceDir/LinuxServer-KFEngine.ini" "LogFiles" "PurgeLogsDays" "0"
|
||||||
|
multini -s "$InstanceDir/LinuxServer-KFEngine.ini" "LogFiles" "LogTimes" "False"
|
||||||
|
multini -s "$InstanceDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "AuthenticationClass" "WebAdmin.MultiWebAdminAuth"
|
||||||
|
multini -s "$InstanceDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "bHttpAuth" "True"
|
||||||
|
multini -s "$InstanceDir/KFWebAdmin.ini" "WebAdmin.Chatlog" "Filename" "$Instance-chat"
|
||||||
|
multini -s "$InstanceDir/KFWebAdmin.ini" "WebAdmin.Chatlog" "bIncludeTimeStamp" "True"
|
||||||
|
|
||||||
|
# LOGGING?: LinuxServer-KFGame.ini bLog*
|
||||||
|
|
||||||
echo "Instance $Instance created. See /etc/$ScriptName/instances$BetaPostfix/$Instance for edit configuration"
|
echo "Instance $Instance created. See /etc/$ScriptName/instances$BetaPostfix/$Instance for edit configuration"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -480,6 +490,9 @@ function first_install ()
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf "$LogDir"
|
||||||
|
ln -s "/var/log/kf2-srv$BetaPostfix" "$LogDir"
|
||||||
|
|
||||||
echo "Creating base ini files"
|
echo "Creating base ini files"
|
||||||
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
||||||
while true
|
while true
|
||||||
@ -501,6 +514,9 @@ function first_install ()
|
|||||||
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
|
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
|
||||||
echo "Setting up WebAdmin"
|
echo "Setting up WebAdmin"
|
||||||
multini -s "$DefaultConfigDir/KFWeb.ini" "IpDrv.WebServer" "bEnabled" "true"
|
multini -s "$DefaultConfigDir/KFWeb.ini" "IpDrv.WebServer" "bEnabled" "true"
|
||||||
|
multini -s "$DefaultConfigDir/LinuxServer-KFEngine.ini" "LogFiles" "PurgeLogsDays" "0"
|
||||||
|
multini -s "$DefaultConfigDir/LinuxServer-KFEngine.ini" "LogFiles" "LogTimes" "False"
|
||||||
|
|
||||||
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
@ -512,6 +528,9 @@ function first_install ()
|
|||||||
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
|
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
|
||||||
multini -s "$DefaultConfigDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "AuthenticationClass" "WebAdmin.MultiWebAdminAuth"
|
multini -s "$DefaultConfigDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "AuthenticationClass" "WebAdmin.MultiWebAdminAuth"
|
||||||
multini -s "$DefaultConfigDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "bHttpAuth" "True"
|
multini -s "$DefaultConfigDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "bHttpAuth" "True"
|
||||||
|
multini -s "$DefaultConfigDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "bChatLog" "True"
|
||||||
|
multini -s "$DefaultConfigDir/KFWebAdmin.ini" "WebAdmin.Chatlog" "Filename" "default-chat"
|
||||||
|
multini -s "$DefaultConfigDir/KFWebAdmin.ini" "WebAdmin.Chatlog" "bIncludeTimeStamp" "True"
|
||||||
|
|
||||||
echo "Wait while WebAdmin up"
|
echo "Wait while WebAdmin up"
|
||||||
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
||||||
@ -804,9 +823,7 @@ function workshop_del () # $*: WorkshopID[s]
|
|||||||
local WsName=$(name_by_workshopID "$WorkshopID")
|
local WsName=$(name_by_workshopID "$WorkshopID")
|
||||||
local Cache="$CacheDir/$WorkshopID"
|
local Cache="$CacheDir/$WorkshopID"
|
||||||
local Downl="$DownloadDir/$WorkshopID"
|
local Downl="$DownloadDir/$WorkshopID"
|
||||||
echo -e "Clear cache:
|
echo -e "Clear cache:\n$Cache\n$Downl"
|
||||||
$Cache
|
|
||||||
$Downl"
|
|
||||||
rm -rf "$Cache" "$Downl"
|
rm -rf "$Cache" "$Downl"
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
@ -1221,6 +1238,7 @@ AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64"
|
|||||||
DefaultConfigDir="$InstallDir/KFGame/Config"
|
DefaultConfigDir="$InstallDir/KFGame/Config"
|
||||||
DownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
DownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
||||||
CacheDir="$InstallDir/KFGame/Cache"
|
CacheDir="$InstallDir/KFGame/Cache"
|
||||||
|
LogDir="$InstallDir/KFGame/Logs"
|
||||||
InstanceConfigDir="/etc/kf2-srv/instances$BetaPostfix"
|
InstanceConfigDir="/etc/kf2-srv/instances$BetaPostfix"
|
||||||
InstanceConfigLnk="$DefaultConfigDir/instances"
|
InstanceConfigLnk="$DefaultConfigDir/instances"
|
||||||
MainConfigTemplate="/etc/kf2-srv/main.conf.template"
|
MainConfigTemplate="/etc/kf2-srv/main.conf.template"
|
||||||
|
@ -5,8 +5,9 @@ Description=Killing Floor 2 Beta Server Daemon - %i
|
|||||||
User=steam
|
User=steam
|
||||||
Group=steam
|
Group=steam
|
||||||
Type=simple
|
Type=simple
|
||||||
StandardOutput=null
|
StandardOutput=syslog
|
||||||
StandardError=null
|
StandardError=syslog
|
||||||
|
SyslogIdentifier=kf2-srv-beta/%i
|
||||||
EnvironmentFile=/etc/kf2-srv/instances-beta/%i/main.conf
|
EnvironmentFile=/etc/kf2-srv/instances-beta/%i/main.conf
|
||||||
ExecStart=/usr/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}
|
ExecStart=/usr/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=always
|
||||||
|
@ -5,8 +5,9 @@ Description=Killing Floor 2 Server Daemon - %i
|
|||||||
User=steam
|
User=steam
|
||||||
Group=steam
|
Group=steam
|
||||||
Type=simple
|
Type=simple
|
||||||
StandardOutput=null
|
StandardOutput=syslog
|
||||||
StandardError=null
|
StandardError=syslog
|
||||||
|
SyslogIdentifier=kf2-srv/%i
|
||||||
EnvironmentFile=/etc/kf2-srv/instances/%i/main.conf
|
EnvironmentFile=/etc/kf2-srv/instances/%i/main.conf
|
||||||
ExecStart=/usr/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}
|
ExecStart=/usr/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=always
|
||||||
|
16
SOURCES/logrotate-kf2-srv
Normal file
16
SOURCES/logrotate-kf2-srv
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/var/log/kf2-srv/*.log
|
||||||
|
/var/log/kf2-srv-beta/*.log
|
||||||
|
{
|
||||||
|
daily
|
||||||
|
missingok
|
||||||
|
rotate 7
|
||||||
|
create 0644
|
||||||
|
missingok
|
||||||
|
compress
|
||||||
|
notifempty
|
||||||
|
postrotate
|
||||||
|
test -s /run/rsyslogd.pid && kill -HUP $(cat /run/rsyslogd.pid)
|
||||||
|
# postrotate script should always return 0
|
||||||
|
true
|
||||||
|
endscript
|
||||||
|
}
|
8
SOURCES/rsyslog-kf2-srv.conf
Normal file
8
SOURCES/rsyslog-kf2-srv.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
global(parser.permitSlashInProgramName="on")
|
||||||
|
|
||||||
|
$template NAMED_LOG,"/var/log/%programname%.log"
|
||||||
|
|
||||||
|
$FileCreateMode 0644
|
||||||
|
$Umask 0022
|
||||||
|
if $programname startswith 'kf2-srv' then ?NAMED_LOG
|
||||||
|
& stop
|
@ -1,7 +1,7 @@
|
|||||||
%global steamuser steam
|
%global steamuser steam
|
||||||
|
|
||||||
Name: kf2-srv
|
Name: kf2-srv
|
||||||
Version: 0.10.1
|
Version: 0.11.0
|
||||||
Release: 1%{dist}
|
Release: 1%{dist}
|
||||||
Summary: Killing Floor 2 server
|
Summary: Killing Floor 2 server
|
||||||
Group: Amusements/Games
|
Group: Amusements/Games
|
||||||
@ -20,6 +20,8 @@ Source9: %{name}-beta-update.service
|
|||||||
Source10: %{name}-beta-update.timer
|
Source10: %{name}-beta-update.timer
|
||||||
Source11: %{name}.conf
|
Source11: %{name}.conf
|
||||||
Source12: COPYING
|
Source12: COPYING
|
||||||
|
Source13: rsyslog-%{name}.conf
|
||||||
|
Source14: logrotate-%{name}
|
||||||
|
|
||||||
Requires: systemd >= 219
|
Requires: systemd >= 219
|
||||||
Requires: steamcmd
|
Requires: steamcmd
|
||||||
@ -34,6 +36,8 @@ Requires: sudo
|
|||||||
Requires: psmisc
|
Requires: psmisc
|
||||||
Requires: gawk
|
Requires: gawk
|
||||||
Requires: multini >= 0.2.3
|
Requires: multini >= 0.2.3
|
||||||
|
Requires: rsyslog >= 8.25.0
|
||||||
|
Requires: logrotate
|
||||||
|
|
||||||
Provides: %{name}
|
Provides: %{name}
|
||||||
|
|
||||||
@ -53,9 +57,13 @@ install -d %{buildroot}/%{_prefix}/lib/firewalld/services
|
|||||||
install -d %{buildroot}/%{_sysconfdir}/%{name}/instances
|
install -d %{buildroot}/%{_sysconfdir}/%{name}/instances
|
||||||
install -d %{buildroot}/%{_sysconfdir}/%{name}/instances-beta
|
install -d %{buildroot}/%{_sysconfdir}/%{name}/instances-beta
|
||||||
install -d %{buildroot}/%{_sysconfdir}/%{name}/mapcycles
|
install -d %{buildroot}/%{_sysconfdir}/%{name}/mapcycles
|
||||||
|
install -d %{buildroot}/%{_sysconfdir}/rsyslog.d
|
||||||
|
install -d %{buildroot}/%{_sysconfdir}/logrotate.d
|
||||||
install -d %{buildroot}/%{_prefix}/games/%{name}
|
install -d %{buildroot}/%{_prefix}/games/%{name}
|
||||||
install -d %{buildroot}/%{_prefix}/games/%{name}-beta
|
install -d %{buildroot}/%{_prefix}/games/%{name}-beta
|
||||||
install -d %{buildroot}/%{_datadir}/licenses/%{name}
|
install -d %{buildroot}/%{_datadir}/licenses/%{name}
|
||||||
|
install -d %{buildroot}/%{_localstatedir}/log/%{name}
|
||||||
|
install -d %{buildroot}/%{_localstatedir}/log/%{name}-beta
|
||||||
|
|
||||||
# access rights are used here to prevent warnings when building the package
|
# access rights are used here to prevent warnings when building the package
|
||||||
install -m 755 %{SOURCE1} %{buildroot}/%{_bindir}
|
install -m 755 %{SOURCE1} %{buildroot}/%{_bindir}
|
||||||
@ -70,6 +78,8 @@ install -m 644 %{SOURCE9} %{buildroot}/%{_prefix}/lib/systemd/system
|
|||||||
install -m 644 %{SOURCE10} %{buildroot}/%{_prefix}/lib/systemd/system
|
install -m 644 %{SOURCE10} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||||
install -m 644 %{SOURCE11} %{buildroot}/%{_sysconfdir}/%{name}
|
install -m 644 %{SOURCE11} %{buildroot}/%{_sysconfdir}/%{name}
|
||||||
install -m 644 %{SOURCE12} %{buildroot}/%{_datadir}/licenses/%{name}
|
install -m 644 %{SOURCE12} %{buildroot}/%{_datadir}/licenses/%{name}
|
||||||
|
install -m 644 %{SOURCE13} %{buildroot}/%{_sysconfdir}/rsyslog.d/%{name}.conf
|
||||||
|
install -m 644 %{SOURCE14} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
@ -81,6 +91,8 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/instances
|
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/instances
|
||||||
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/instances-beta
|
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/instances-beta
|
||||||
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/mapcycles
|
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/mapcycles
|
||||||
|
%attr(775,root,%{steamuser}) %dir %{_localstatedir}/log/%{name}
|
||||||
|
%attr(775,root,%{steamuser}) %dir %{_localstatedir}/log/%{name}-beta
|
||||||
%attr(644,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/main.conf.template
|
%attr(644,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/main.conf.template
|
||||||
%attr(644,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
|
%attr(644,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
|
||||||
%attr(644,root,root) %config(noreplace) %{_prefix}/lib/firewalld/services/%{name}.xml
|
%attr(644,root,root) %config(noreplace) %{_prefix}/lib/firewalld/services/%{name}.xml
|
||||||
@ -88,6 +100,8 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%attr(755,root,root) %{_bindir}/%{name}-beta
|
%attr(755,root,root) %{_bindir}/%{name}-beta
|
||||||
%attr(644,root,root) %{_prefix}/lib/systemd/system/*
|
%attr(644,root,root) %{_prefix}/lib/systemd/system/*
|
||||||
%attr(644,root,root) %doc %{_datadir}/licenses/%{name}/*
|
%attr(644,root,root) %doc %{_datadir}/licenses/%{name}/*
|
||||||
|
%attr(644,root,root) %{_sysconfdir}/rsyslog.d/%{name}.conf
|
||||||
|
%attr(644,root,root) %{_sysconfdir}/logrotate.d/%{name}
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
if [[ $1 -eq 0 ]] ; then # Uninstall
|
if [[ $1 -eq 0 ]] ; then # Uninstall
|
||||||
@ -99,7 +113,14 @@ if [[ $1 -eq 0 ]] ; then # Uninstall
|
|||||||
rm -rf %{_sysconfdir}/%{name}/instances-beta/default
|
rm -rf %{_sysconfdir}/%{name}/instances-beta/default
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%post
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart rsyslog.service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jul 8 2020 GenZmeY <genzmey@gmail.com> - 0.11.0-1
|
||||||
|
- logging (rsyslog + logrotate).
|
||||||
|
|
||||||
* Wed Jul 8 2020 GenZmeY <genzmey@gmail.com> - 0.10.1-1
|
* Wed Jul 8 2020 GenZmeY <genzmey@gmail.com> - 0.10.1-1
|
||||||
- add COPYING to distributive;
|
- add COPYING to distributive;
|
||||||
- add license info to kf2-srv-beta;
|
- add license info to kf2-srv-beta;
|
||||||
|
Loading…
Reference in New Issue
Block a user