rename main.conf to instance.conf

This commit is contained in:
GenZmeY 2020-07-13 05:04:36 +03:00
parent 43d3b275d5
commit ab94711bb9
5 changed files with 27 additions and 26 deletions

View File

@ -204,7 +204,7 @@ function new_instance () # $*: InstanceName[s]
local MaxWebAdminPort='8080' local MaxWebAdminPort='8080'
for Instance in $(show_instances) for Instance in $(show_instances)
do do
local Config="$InstanceConfigDir/$Instance/main.conf" local Config="$InstanceConfigDir/$Instance/instance.conf"
local GamePort=$(multini --get "$Config" '' 'PortGame') local GamePort=$(multini --get "$Config" '' 'PortGame')
local WebAdminPort=$(multini --get "$Config" '' 'PortWeb') local WebAdminPort=$(multini --get "$Config" '' 'PortWeb')
local QueryPort=$(multini --get "$Config" '' 'PortQuery') local QueryPort=$(multini --get "$Config" '' 'PortQuery')
@ -228,7 +228,7 @@ function new_instance () # $*: InstanceName[s]
install $DirMode "$InstanceDir" install $DirMode "$InstanceDir"
install $DirMode "$InstanceDir/LinuxServer" install $DirMode "$InstanceDir/LinuxServer"
install $FileMode "$MainConfigTemplate" "$InstanceDir/main.conf" install $FileMode "$InstanceConfigTemplate" "$InstanceDir/instance.conf"
install $FileMode "$DefaultConfigDir/KFAI.ini" "$InstanceDir" install $FileMode "$DefaultConfigDir/KFAI.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/KFWeb.ini" "$InstanceDir" install $FileMode "$DefaultConfigDir/KFWeb.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/KFWebAdmin.ini" "$InstanceDir" install $FileMode "$DefaultConfigDir/KFWebAdmin.ini" "$InstanceDir"
@ -244,9 +244,9 @@ function new_instance () # $*: InstanceName[s]
((MaxGamePort++)); ((MaxQueryPort++)); ((MaxWebAdminPort++)) ((MaxGamePort++)); ((MaxQueryPort++)); ((MaxWebAdminPort++))
multini -s "$InstanceDir/main.conf" '' 'PortGame' "$MaxGamePort" multini -s "$InstanceDir/instance.conf" '' 'PortGame' "$MaxGamePort"
multini -s "$InstanceDir/main.conf" '' 'PortQuery' "$MaxQueryPort" multini -s "$InstanceDir/instance.conf" '' 'PortQuery' "$MaxQueryPort"
multini -s "$InstanceDir/main.conf" '' 'PortWeb' "$MaxWebAdminPort" multini -s "$InstanceDir/instance.conf" '' 'PortWeb' "$MaxWebAdminPort"
multini -s "$InstanceDir/KFWeb.ini" "IpDrv.WebServer" "bEnabled" "true" 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" "PurgeLogsDays" "0"
@ -304,16 +304,16 @@ function instance_status () # $1: InstanceName
else else
local IsRuning="stopped" local IsRuning="stopped"
fi fi
local Comment=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Comment") local Comment=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "Comment")
local GamePort=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "PortGame") local GamePort=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "PortGame")
local WebAdminPort=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "PortWeb") local WebAdminPort=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "PortWeb")
local QueryPort=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "PortQuery") local QueryPort=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "PortQuery")
local GameType=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Game") local GameType=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "Game")
local GameLength=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Length") local GameLength=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "Length")
local GameDifficulty=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Difficulty") local GameDifficulty=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "Difficulty")
local Map=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Map") local Map=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "Map")
local Mutators=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Mutators") local Mutators=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "Mutators")
local Args=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Args") local Args=$( multini -g "$InstanceConfigDir/$Instance/instance.conf" '' "Args")
local DisplayGameType='' local DisplayGameType=''
local DisplayGameLength='' local DisplayGameLength=''
@ -398,7 +398,7 @@ function make_default_instance () # $1: Dir
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir" install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir"
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir/LinuxServer" install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir/LinuxServer"
install -g "$SteamUser" -o "$SteamUser" -m 664 "$MainConfigTemplate" "$InstanceDir/main.conf" install -g "$SteamUser" -o "$SteamUser" -m 664 "$InstanceConfigTemplate" "$InstanceDir/instance.conf"
ln -s "$DefaultConfigDir/KFAI.ini" "$InstanceDir/KFAI.ini" ln -s "$DefaultConfigDir/KFAI.ini" "$InstanceDir/KFAI.ini"
ln -s "$DefaultConfigDir/KFWeb.ini" "$InstanceDir/KFWeb.ini" ln -s "$DefaultConfigDir/KFWeb.ini" "$InstanceDir/KFWeb.ini"
ln -s "$DefaultConfigDir/KFWebAdmin.ini" "$InstanceDir/KFWebAdmin.ini" ln -s "$DefaultConfigDir/KFWebAdmin.ini" "$InstanceDir/KFWebAdmin.ini"
@ -1130,14 +1130,13 @@ function admin_curl () # $1: Instance, $2: URL, $*: Request
{ {
local Instance="$1" local Instance="$1"
local URL="$2" local URL="$2"
local MainConf="$InstanceConfigDir/$Instance/main.conf" local InstanceConf="$InstanceConfigDir/$Instance/instance.conf"
local WebPort=$(multini --get "$MainConf" '' "PortWeb") local WebPort=$(multini --get "$InstanceConf" '' "PortWeb")
shift; shift shift; shift
curl -s -o "/dev/null" -u "$ServerBotLogin:$ServerBotPassword" "localhost:$WebPort/$URL" $* curl -s -o "/dev/null" -u "$ServerBotLogin:$ServerBotPassword" "localhost:$WebPort/$URL" $*
} }
function password_game () # $1: Password (if empty, use: ''), $*: Instance[s] function password_game () # $1: Password (if empty, use: ''), $*: Instance[s]
{
if echo "$1" | grep -qP '\s'; then if echo "$1" | grep -qP '\s'; then
echo "Password should not contain spaces" echo "Password should not contain spaces"
return 1 return 1
@ -1242,7 +1241,7 @@ CacheDir="$InstallDir/KFGame/Cache"
LogDir="$InstallDir/KFGame/Logs" 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" InstanceConfigTemplate="/etc/kf2-srv/instance.conf.template"
if [[ $# -eq 0 ]]; then show_help; exit 0; fi if [[ $# -eq 0 ]]; then show_help; exit 0; fi
case $1 in case $1 in

View File

@ -11,7 +11,7 @@ Type=simple
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog
SyslogIdentifier=kf2-srv-beta/%i SyslogIdentifier=kf2-srv-beta/%i
EnvironmentFile=/etc/kf2-srv/instances-beta/%i/main.conf EnvironmentFile=/etc/kf2-srv/instances-beta/%i/instance.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

View File

@ -11,7 +11,7 @@ Type=simple
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog
SyslogIdentifier=kf2-srv/%i SyslogIdentifier=kf2-srv/%i
EnvironmentFile=/etc/kf2-srv/instances/%i/main.conf EnvironmentFile=/etc/kf2-srv/instances/%i/instance.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

View File

@ -1,7 +1,7 @@
%global steamuser steam %global steamuser steam
Name: kf2-srv Name: kf2-srv
Version: 0.12.0 Version: 0.12.1
Release: 1%{dist} Release: 1%{dist}
Summary: Killing Floor 2 server Summary: Killing Floor 2 server
Group: Amusements/Games Group: Amusements/Games
@ -14,7 +14,7 @@ Source3: %{name}.xml
Source4: %{name}@.service Source4: %{name}@.service
Source5: %{name}-update.service Source5: %{name}-update.service
Source6: %{name}-update.timer Source6: %{name}-update.timer
Source7: main.conf.template Source7: instance.conf.template
Source8: %{name}-beta@.service Source8: %{name}-beta@.service
Source9: %{name}-beta-update.service Source9: %{name}-beta-update.service
Source10: %{name}-beta-update.timer Source10: %{name}-beta-update.timer
@ -101,7 +101,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(0775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/mapcycles %attr(0775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/mapcycles
%attr(0770,root,%{steamuser}) %dir %{_localstatedir}/log/%{name} %attr(0770,root,%{steamuser}) %dir %{_localstatedir}/log/%{name}
%attr(0770,root,%{steamuser}) %dir %{_localstatedir}/log/%{name}-beta %attr(0770,root,%{steamuser}) %dir %{_localstatedir}/log/%{name}-beta
%attr(0664,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/main.conf.template %attr(0664,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/instance.conf.template
%attr(0664,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf %attr(0664,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%attr(0640,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/bot.conf %attr(0640,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/bot.conf
%attr(0644,root,root) %config(noreplace) %{_prefix}/lib/firewalld/services/%{name}.xml %attr(0644,root,root) %config(noreplace) %{_prefix}/lib/firewalld/services/%{name}.xml
@ -130,6 +130,9 @@ systemctl try-restart rsyslog.service
#fi #fi
%changelog %changelog
* Mon Jul 13 2020 GenZmeY <genzmey@gmail.com> - 0.12.1-1
- rename main.conf to instance.conf.
* Mon Jul 13 2020 GenZmeY <genzmey@gmail.com> - 0.12.0-1 * Mon Jul 13 2020 GenZmeY <genzmey@gmail.com> - 0.12.0-1
- chat logs without timestamp; - chat logs without timestamp;
- update rsyslog config - now logs will be create with steam group and 640 permissions; - update rsyslog config - now logs will be create with steam group and 640 permissions;

1
TODO
View File

@ -11,7 +11,6 @@
- generate unique password for server bot on install - generate unique password for server bot on install
- parallel actions - parallel actions
- bash completion - bash completion
- rename main.conf to instance.conf
################### ###################