fix: endless downloading
This commit is contained in:
parent
f7270c73a1
commit
b618acd1e1
@ -222,13 +222,13 @@ function new_instance () # $*: InstanceName[s]
|
|||||||
|
|
||||||
local InstanceDir="$InstanceConfigDir/$Instance"
|
local InstanceDir="$InstanceConfigDir/$Instance"
|
||||||
|
|
||||||
local DirMode="-d -g $SteamUser -o $SteamUser -m 775"
|
local DirMode="-d -g $SteamUser -o $ForceIniGroup -m 775"
|
||||||
local FileMode=" -g $SteamUser -o $SteamUser -m 664"
|
local FileMode=" -g $SteamUser -o $ForceIniGroup -m $ForceIniPermissions"
|
||||||
|
|
||||||
install $DirMode "$InstanceDir"
|
install $DirMode "$InstanceDir"
|
||||||
install $DirMode "$InstanceDir/LinuxServer"
|
install $DirMode "$InstanceDir/LinuxServer"
|
||||||
|
|
||||||
install $FileMode "$InstanceConfigTemplate" "$InstanceDir/instance.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"
|
||||||
@ -255,8 +255,6 @@ function new_instance () # $*: InstanceName[s]
|
|||||||
multini -s "$InstanceDir/KFWebAdmin.ini" "WebAdmin.WebAdmin" "bHttpAuth" "True"
|
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" "Filename" "$Instance-chat"
|
||||||
multini -s "$InstanceDir/KFWebAdmin.ini" "WebAdmin.Chatlog" "bIncludeTimeStamp" "False"
|
multini -s "$InstanceDir/KFWebAdmin.ini" "WebAdmin.Chatlog" "bIncludeTimeStamp" "False"
|
||||||
|
|
||||||
# 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
|
||||||
@ -396,9 +394,9 @@ function make_default_instance () # $1: Dir
|
|||||||
{
|
{
|
||||||
local InstanceDir="$InstanceConfigDir/default"
|
local InstanceDir="$InstanceConfigDir/default"
|
||||||
|
|
||||||
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir"
|
install -d -g "$SteamUser" -o "$ForceIniGroup" -m 775 "$InstanceDir"
|
||||||
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir/LinuxServer"
|
install -d -g "$SteamUser" -o "$ForceIniGroup" -m 775 "$InstanceDir/LinuxServer"
|
||||||
install -g "$SteamUser" -o "$SteamUser" -m 664 "$InstanceConfigTemplate" "$InstanceDir/instance.conf"
|
install -g "$SteamUser" -o "$ForceIniGroup" -m $ForceIniPermissions "$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"
|
||||||
@ -433,7 +431,7 @@ function fix_ini_permissions () # $1: Dir
|
|||||||
{
|
{
|
||||||
find "$1" \( -type l -o -type f \) -name '*.ini' | \
|
find "$1" \( -type l -o -type f \) -name '*.ini' | \
|
||||||
xargs --max-procs=$(nproc) -I {} \
|
xargs --max-procs=$(nproc) -I {} \
|
||||||
sh -c "chmod 664 {}; chown $SteamUser:$SteamUser {}"
|
sh -c "chmod $ForceIniPermissions {}; chown $SteamUser:$ForceIniGroup {}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function fix_ini_eol () # $1: Dir
|
function fix_ini_eol () # $1: Dir
|
||||||
@ -453,34 +451,36 @@ function fix_steamclient_so ()
|
|||||||
ln -s "/usr/share/steamcmd/linux64/steamclient.so" "$InstallDir/Binaries/Win64/lib64/steamclient.so"
|
ln -s "/usr/share/steamcmd/linux64/steamclient.so" "$InstallDir/Binaries/Win64/lib64/steamclient.so"
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_map_dirs ()
|
function create_cache ()
|
||||||
{
|
{
|
||||||
# space saving
|
if [[ -d "$DownloadDir" ]]; then
|
||||||
local InstallDirOrig="/usr/games/kf2-srv"
|
if ! [[ -L "$DefaultDownloadDir" ]]; then
|
||||||
local InstallDirBeta="/usr/games/kf2-srv-beta"
|
if [[ -d "$DefaultDownloadDir" ]]; then
|
||||||
local DownloadDirOrig="$InstallDirOrig/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
rm -rf "$DefaultDownloadDir" "$DownloadDir"
|
||||||
local CacheDirOrig="$InstallDirOrig/KFGame/Cache"
|
ln -s "$DownloadDir" "$DefaultDownloadDir"
|
||||||
local DownloadDirBeta="$InstallDirBeta/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
else
|
||||||
local CacheDirBeta="$InstallDirBeta/KFGame/Cache"
|
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstallDir/Binaries/Win64/steamapps"
|
||||||
|
ln -s "$DownloadDir" "$DefaultDownloadDir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ -L "$DefaultDownloadDir" ]]; then
|
||||||
|
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$DownloadDir"
|
||||||
|
elif [[ -d "$DefaultDownloadDir" ]]; then
|
||||||
|
mv -rf "$DefaultDownloadDir" "$DownloadDir"
|
||||||
|
ln -s "$DownloadDir" "$DefaultDownloadDir"
|
||||||
|
else
|
||||||
|
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$DownloadDir"
|
||||||
|
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstallDir/Binaries/Win64/steamapps"
|
||||||
|
ln -s "$DownloadDir" "$DefaultDownloadDir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z "$BetaPostfix" ]]; then # Orig
|
if ! [[ -d "$CacheDir" ]]; then
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$DownloadDirOrig"
|
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$CacheDir"
|
||||||
if [[ -d "$CacheDirBeta" ]]; then
|
fi
|
||||||
ln -s "$CacheDirBeta" "$CacheDirOrig"
|
if ! [[ -L "$DefaultCacheDir" ]]; then
|
||||||
rm -rf "$DownloadDirOrig"
|
ln -s "$CacheDir" "$DefaultCacheDir"
|
||||||
ln -s "$DownloadDirBeta" "$DownloadDirOrig"
|
|
||||||
else
|
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$CacheDirOrig"
|
|
||||||
fi
|
|
||||||
else # Beta
|
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$DownloadDirBeta"
|
|
||||||
if [[ -d "$CacheDirOrig" ]]; then
|
|
||||||
ln -s "$CacheDirOrig" "$CacheDirBeta"
|
|
||||||
rm -rf "$DownloadDirBeta"
|
|
||||||
ln -s "$DownloadDirOrig" "$DownloadDirBeta"
|
|
||||||
else
|
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$CacheDirBeta"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,8 +491,8 @@ function first_install ()
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "$LogDir"
|
rm -rf "$DefaultLogDir"
|
||||||
ln -s "/var/log/kf2-srv$BetaPostfix" "$LogDir"
|
ln -s "$LogDir" "$DefaultLogDir"
|
||||||
|
|
||||||
echo "Creating base ini files"
|
echo "Creating base ini files"
|
||||||
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
sudo -u "$SteamUser" $AppBin &> /dev/null &
|
||||||
@ -577,9 +577,9 @@ function first_install ()
|
|||||||
do sleep 2; done
|
do sleep 2; done
|
||||||
|
|
||||||
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
|
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
|
||||||
create_map_dirs
|
create_cache
|
||||||
fix_steamclient_so
|
fix_steamclient_so
|
||||||
ln -s "$InstanceConfigDir" "$InstanceConfigLnk"
|
ln -s "$InstanceConfigDir" "$DefaultConfigDir/instances"
|
||||||
make_default_instance
|
make_default_instance
|
||||||
echo "KF2 succesfully installed"
|
echo "KF2 succesfully installed"
|
||||||
}
|
}
|
||||||
@ -775,7 +775,7 @@ function workshop_list ()
|
|||||||
for WorkshopID in $(workshop_list_ids)
|
for WorkshopID in $(workshop_list_ids)
|
||||||
do
|
do
|
||||||
local Cache="$CacheDir/$WorkshopID"
|
local Cache="$CacheDir/$WorkshopID"
|
||||||
local Downl="$DownloadDir/$WorkshopID"
|
local Downl="$DownloadDir/content/$AppClientNum/$WorkshopID"
|
||||||
local Url="https://steamcommunity.com/sharedfiles/filedetails/?id=$WorkshopID"
|
local Url="https://steamcommunity.com/sharedfiles/filedetails/?id=$WorkshopID"
|
||||||
local WsName=$(name_by_workshopID "$WorkshopID")
|
local WsName=$(name_by_workshopID "$WorkshopID")
|
||||||
if [[ -n "$WsName" ]]; then
|
if [[ -n "$WsName" ]]; then
|
||||||
@ -823,7 +823,7 @@ function workshop_del () # $*: WorkshopID[s]
|
|||||||
local WorkshopID=$(any_to_workshopID "$Map")
|
local WorkshopID=$(any_to_workshopID "$Map")
|
||||||
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/content/$AppClientNum/$WorkshopID"
|
||||||
echo -e "Clear cache:\n$Cache\n$Downl"
|
echo -e "Clear cache:\n$Cache\n$Downl"
|
||||||
rm -rf "$Cache" "$Downl"
|
rm -rf "$Cache" "$Downl"
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
@ -1189,7 +1189,7 @@ function password_admin () # $1: Password (if empty, use: ''), $*: Instance[s]
|
|||||||
local Service=$(service_name "$Instance")
|
local Service=$(service_name "$Instance")
|
||||||
if systemctl -q is-active $Service ; then
|
if systemctl -q is-active $Service ; then
|
||||||
admin_curl "$Instance" "ServerAdmin/policy/passwords" \
|
admin_curl "$Instance" "ServerAdmin/policy/passwords" \
|
||||||
--request POST \
|
--request POST \
|
||||||
--data action="adminpassword" \
|
--data action="adminpassword" \
|
||||||
--data adminpw1="$Password" \
|
--data adminpw1="$Password" \
|
||||||
--data adminpw2="$Password"
|
--data adminpw2="$Password"
|
||||||
@ -1236,12 +1236,17 @@ fi
|
|||||||
|
|
||||||
InstallDir="/usr/games/kf2-srv$BetaPostfix"
|
InstallDir="/usr/games/kf2-srv$BetaPostfix"
|
||||||
AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64"
|
AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64"
|
||||||
|
|
||||||
DefaultConfigDir="$InstallDir/KFGame/Config"
|
DefaultConfigDir="$InstallDir/KFGame/Config"
|
||||||
DownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
DefaultDownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop"
|
||||||
CacheDir="$InstallDir/KFGame/Cache"
|
DefaultCacheDir="$InstallDir/KFGame/Cache"
|
||||||
LogDir="$InstallDir/KFGame/Logs"
|
DefaultLogDir="$InstallDir/KFGame/Logs"
|
||||||
|
|
||||||
|
DownloadDir="/var/cache/kf2-srv/workshop"
|
||||||
|
CacheDir="/var/cache/kf2-srv/cache"
|
||||||
|
LogDir="/var/log/kf2-srv$BetaPostfix"
|
||||||
|
|
||||||
InstanceConfigDir="/etc/kf2-srv/instances$BetaPostfix"
|
InstanceConfigDir="/etc/kf2-srv/instances$BetaPostfix"
|
||||||
InstanceConfigLnk="$DefaultConfigDir/instances"
|
|
||||||
InstanceConfigTemplate="/etc/kf2-srv/instance.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
|
||||||
|
@ -16,7 +16,8 @@ ModeNames['KFGameContent.KFGameInfo_VersusSurvival']='Versus'
|
|||||||
# Add mutators to the end of the list, similar to what is already there:
|
# Add mutators to the end of the list, similar to what is already there:
|
||||||
MutNames['ServerExtMut.ServerExtMut']='RPG'
|
MutNames['ServerExtMut.ServerExtMut']='RPG'
|
||||||
|
|
||||||
# These parameters works only if "kf2-srv-force-attr.service" is active
|
# These parameters are used when creating new instances.
|
||||||
|
# In order for the parameters to be applied to the files that the working server creates, the "kf2-srv-force-attr.service" must be active.
|
||||||
ForceIniPermissions=664
|
ForceIniPermissions=664
|
||||||
ForceLogPermissions=640
|
ForceLogPermissions=640
|
||||||
ForceIniGroup=steam
|
ForceIniGroup=steam
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%global steamuser steam
|
%global steamuser steam
|
||||||
|
|
||||||
Name: kf2-srv
|
Name: kf2-srv
|
||||||
Version: 0.12.1
|
Version: 0.13.0
|
||||||
Release: 1%{dist}
|
Release: 1%{dist}
|
||||||
Summary: Killing Floor 2 server
|
Summary: Killing Floor 2 server
|
||||||
Group: Amusements/Games
|
Group: Amusements/Games
|
||||||
@ -69,6 +69,7 @@ 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}
|
||||||
install -d %{buildroot}/%{_localstatedir}/log/%{name}-beta
|
install -d %{buildroot}/%{_localstatedir}/log/%{name}-beta
|
||||||
|
install -d %{buildroot}/%{_localstatedir}/cache/kf2-srv
|
||||||
|
|
||||||
# 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}
|
||||||
@ -89,6 +90,10 @@ install -m 644 %{SOURCE15} %{buildroot}/%{_sysconfdir}/%{name}
|
|||||||
install -m 755 %{SOURCE16} %{buildroot}/%{_sbindir}
|
install -m 755 %{SOURCE16} %{buildroot}/%{_sbindir}
|
||||||
install -m 644 %{SOURCE17} %{buildroot}/%{_prefix}/lib/systemd/system
|
install -m 644 %{SOURCE17} %{buildroot}/%{_prefix}/lib/systemd/system
|
||||||
|
|
||||||
|
%check
|
||||||
|
bash -n %{buildroot}/%{_bindir}/%{name}
|
||||||
|
bash -n %{buildroot}/%{_bindir}/%{name}-beta
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
@ -101,6 +106,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(0775,root,%{steamuser}) %dir %{_localstatedir}/cache/kf2-srv
|
||||||
%attr(0664,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/instance.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
|
||||||
@ -121,15 +127,22 @@ if [[ $1 -eq 0 ]] ; then # Uninstall
|
|||||||
rm -rf %{_prefix}/games/%{name}-beta/*
|
rm -rf %{_prefix}/games/%{name}-beta/*
|
||||||
rm -rf %{_sysconfdir}/%{name}/instances/default
|
rm -rf %{_sysconfdir}/%{name}/instances/default
|
||||||
rm -rf %{_sysconfdir}/%{name}/instances-beta/default
|
rm -rf %{_sysconfdir}/%{name}/instances-beta/default
|
||||||
|
rm -rf %{_localstatedir}/cache/kf2-srv/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%post
|
%post
|
||||||
#if [[ $1 == 1 ]]; then # Install
|
if [[ $1 == 1 ]]; then # Install
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl try-restart rsyslog.service
|
systemctl try-restart rsyslog.service
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Jul 19 2020 GenZmeY <genzmey@gmail.com> - 0.13.0-1
|
||||||
|
- /var/cache to store the workshop cache;
|
||||||
|
- fixed endless downloading of workshop items that tripware gave us in PC Build 1099 patch;
|
||||||
|
- using ForcePermissions when creating instances;
|
||||||
|
- add %check section to specfile.
|
||||||
|
|
||||||
* Mon Jul 13 2020 GenZmeY <genzmey@gmail.com> - 0.12.1-1
|
* Mon Jul 13 2020 GenZmeY <genzmey@gmail.com> - 0.12.1-1
|
||||||
- rename main.conf to instance.conf.
|
- rename main.conf to instance.conf.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user