Mon Apr 27 2020
This commit is contained in:
parent
081579f75b
commit
2e974cf418
209
SOURCES/kf2-srv
209
SOURCES/kf2-srv
@ -21,7 +21,7 @@ source /etc/steamcmd/steamcmd.conf
|
|||||||
|
|
||||||
ScriptFullname=$(readlink -e "$0")
|
ScriptFullname=$(readlink -e "$0")
|
||||||
ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
|
ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
|
||||||
ScriptVersion="0.7.0"
|
ScriptVersion="0.8.0"
|
||||||
|
|
||||||
AppServerNum="232130"
|
AppServerNum="232130"
|
||||||
AppClientNum="232090"
|
AppClientNum="232090"
|
||||||
@ -74,14 +74,14 @@ function show_help ()
|
|||||||
echo " -di, --disable [INSTANCE] удаляет указанный ЭКЗЕМПЛЯР сервера из"
|
echo " -di, --disable [INSTANCE] удаляет указанный ЭКЗЕМПЛЯР сервера из"
|
||||||
echo " автозапуска; если ЭКЗЕМПЛЯР не указан,"
|
echo " автозапуска; если ЭКЗЕМПЛЯР не указан,"
|
||||||
echo " удаляет все экземпляры сервера из автозапуска"
|
echo " удаляет все экземпляры сервера из автозапуска"
|
||||||
echo " -ml, --map-list отображает список карт из SteamWorkshop"
|
echo " -wl, --workshop-list отображает список ресурсов из SteamWorkshop"
|
||||||
echo " -ms, --map-sync синхронизирует списки сторонних карт в"
|
echo " -wa, --workshop-add [MAP_ID] добавляет ресурс из SteamWorkshop по URL или"
|
||||||
|
echo " WorkshopID"
|
||||||
|
echo " -wd, --workshop-del [MAP_ID] удаляет ресурс SteamWorkshop по URL или WorkshopID"
|
||||||
|
echo " -ws, --workshop-sync синхронизирует списки сторонних карт в"
|
||||||
echo " конфигурационных файлах с имеющимися файлами"
|
echo " конфигурационных файлах с имеющимися файлами"
|
||||||
echo " сторонних карт; синхронизирует списки карт из"
|
echo " сторонних карт; синхронизирует списки карт из"
|
||||||
echo " SteamWorkshop между всеми экземплярами серверов"
|
echo " SteamWorkshop между всеми экземплярами серверов"
|
||||||
echo " -ma, --map-add [MAP_ID] добавляет карту из SteamWorkshop по URL или"
|
|
||||||
echo " WorkshopID"
|
|
||||||
echo " -md, --map-del [MAP_ID] удаляет карту SteamWorkshop по URL или WorkshopID"
|
|
||||||
echo "-mrs, --map-rotate-save [INSTANCE] сохраняет текущий порядок карт для"
|
echo "-mrs, --map-rotate-save [INSTANCE] сохраняет текущий порядок карт для"
|
||||||
echo " указанного ЭКЗЕМПЛЯРА сервера; если ЭКЗЕМПЛЯР"
|
echo " указанного ЭКЗЕМПЛЯРА сервера; если ЭКЗЕМПЛЯР"
|
||||||
echo " не указан, сохраняет порядок для всех ЭКЗЕМПЛЯРОВ"
|
echo " не указан, сохраняет порядок для всех ЭКЗЕМПЛЯРОВ"
|
||||||
@ -163,7 +163,8 @@ function server_exists ()
|
|||||||
|
|
||||||
function updates_aviable ()
|
function updates_aviable ()
|
||||||
{
|
{
|
||||||
# TODO: check
|
return 0 # steamcmd does not show updates even if they are :(
|
||||||
|
# TODO: check updates correctly (but how?)
|
||||||
if [[ -n "$BetaPostfix" ]]; then
|
if [[ -n "$BetaPostfix" ]]; then
|
||||||
local BetaArg="-beta preview"
|
local BetaArg="-beta preview"
|
||||||
fi
|
fi
|
||||||
@ -343,6 +344,7 @@ function validate ()
|
|||||||
fi
|
fi
|
||||||
stop_instance
|
stop_instance
|
||||||
steamcmd +login $SteamLogin +force_install_dir $InstallDir +app_update $AppServerNum $BetaArg validate +exit
|
steamcmd +login $SteamLogin +force_install_dir $InstallDir +app_update $AppServerNum $BetaArg validate +exit
|
||||||
|
fix_steamclient_so
|
||||||
start_instance
|
start_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,6 +381,7 @@ function make_default_instance ()
|
|||||||
install -g "$SteamUser" -o "$SteamUser" -m 664 "$MainConfigTemplate" "$InstanceDir/main.conf"
|
install -g "$SteamUser" -o "$SteamUser" -m 664 "$MainConfigTemplate" "$InstanceDir/main.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/LinuxServer-KFEngine.ini" "$InstanceDir/LinuxServer-KFEngine.ini"
|
ln -s "$DefaultConfigDir/LinuxServer-KFEngine.ini" "$InstanceDir/LinuxServer-KFEngine.ini"
|
||||||
ln -s "$DefaultConfigDir/LinuxServer-KFGame.ini" "$InstanceDir/LinuxServer-KFGame.ini"
|
ln -s "$DefaultConfigDir/LinuxServer-KFGame.ini" "$InstanceDir/LinuxServer-KFGame.ini"
|
||||||
ln -s "$DefaultConfigDir/LinuxServer-KFInput.ini" "$InstanceDir/LinuxServer-KFInput.ini"
|
ln -s "$DefaultConfigDir/LinuxServer-KFInput.ini" "$InstanceDir/LinuxServer-KFInput.ini"
|
||||||
@ -404,28 +407,28 @@ function create_map_dirs ()
|
|||||||
# space saving
|
# space saving
|
||||||
local InstallDirOrig="/usr/games/kf2-srv"
|
local InstallDirOrig="/usr/games/kf2-srv"
|
||||||
local InstallDirBeta="/usr/games/kf2-srv-beta"
|
local InstallDirBeta="/usr/games/kf2-srv-beta"
|
||||||
local DownloadMapsDirOrig="$InstallDirOrig/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
local DownloadDirOrig="$InstallDirOrig/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
||||||
local CacheMapsDirOrig="$InstallDirOrig/KFGame/Cache"
|
local CacheDirOrig="$InstallDirOrig/KFGame/Cache"
|
||||||
local DownloadMapsDirBeta="$InstallDirBeta/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
local DownloadDirBeta="$InstallDirBeta/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
||||||
local CacheMapsDirBeta="$InstallDirBeta/KFGame/Cache"
|
local CacheDirBeta="$InstallDirBeta/KFGame/Cache"
|
||||||
|
|
||||||
if [[ -z "$BetaPostfix" ]]; then # Orig
|
if [[ -z "$BetaPostfix" ]]; then # Orig
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$DownloadMapsDirOrig"
|
sudo -u "$SteamUser" install -d -m 775 "$DownloadDirOrig"
|
||||||
if [[ -d "$CacheMapsDirBeta" ]]; then
|
if [[ -d "$CacheDirBeta" ]]; then
|
||||||
ln -s "$CacheMapsDirBeta" "$CacheMapsDirOrig"
|
ln -s "$CacheDirBeta" "$CacheDirOrig"
|
||||||
rm -rf "$DownloadMapsDirOrig"
|
rm -rf "$DownloadDirOrig"
|
||||||
ln -s "$DownloadMapsDirBeta" "$DownloadMapsDirOrig"
|
ln -s "$DownloadDirBeta" "$DownloadDirOrig"
|
||||||
else
|
else
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$CacheMapsDirOrig"
|
sudo -u "$SteamUser" install -d -m 775 "$CacheDirOrig"
|
||||||
fi
|
fi
|
||||||
else # Beta
|
else # Beta
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$DownloadMapsDirBeta"
|
sudo -u "$SteamUser" install -d -m 775 "$DownloadDirBeta"
|
||||||
if [[ -d "$CacheMapsDirOrig" ]]; then
|
if [[ -d "$CacheDirOrig" ]]; then
|
||||||
ln -s "$CacheMapsDirOrig" "$CacheMapsDirBeta"
|
ln -s "$CacheDirOrig" "$CacheDirBeta"
|
||||||
rm -rf "$DownloadMapsDirBeta"
|
rm -rf "$DownloadDirBeta"
|
||||||
ln -s "$DownloadMapsDirOrig" "$DownloadMapsDirBeta"
|
ln -s "$DownloadDirOrig" "$DownloadDirBeta"
|
||||||
else
|
else
|
||||||
sudo -u "$SteamUser" install -d -m 775 "$CacheMapsDirBeta"
|
sudo -u "$SteamUser" install -d -m 775 "$CacheDirBeta"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -456,9 +459,9 @@ function update_kf2 ()
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep 2
|
sleep 2
|
||||||
# TODO: KFWeb.ini > webadmin=true
|
|
||||||
done
|
done
|
||||||
killall -KILL KFGameSteamServer.bin.x86_64
|
killall -KILL KFGameSteamServer.bin.x86_64
|
||||||
|
multini -s "$DefaultConfigDir/KFWeb.ini" "IpDrv.WebServer" "bEnabled" "true"
|
||||||
create_map_dirs
|
create_map_dirs
|
||||||
fix_steamclient_so
|
fix_steamclient_so
|
||||||
ln -s "$InstanceConfigDir" "$InstanceConfigLnk"
|
ln -s "$InstanceConfigDir" "$InstanceConfigLnk"
|
||||||
@ -607,48 +610,60 @@ function run ()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function map_list_body () # $1: MaplistFile
|
function name_by_workshopID () # $1: WorkshopID
|
||||||
|
{
|
||||||
|
local WorkshopID="$1"
|
||||||
|
local Cache="$CacheDir/$WorkshopID"
|
||||||
|
local Result=""
|
||||||
|
if [[ -d "$Cache" ]]; then
|
||||||
|
Result=$(find "$Cache" -type f -name '*.kfm' -printf '%f\n' | head -n 1)
|
||||||
|
if [[ -z "$Result" ]]; then
|
||||||
|
Result=$(find "$Cache" -type f -name '*.u' -printf '%f\n' | head -n 1)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "$Result"
|
||||||
|
}
|
||||||
|
|
||||||
|
function workshop_list_body () # $1: WorkshopListFile
|
||||||
{
|
{
|
||||||
while read WorkshopID
|
while read WorkshopID
|
||||||
do
|
do
|
||||||
local Cache="$CacheMapsDir/$WorkshopID"
|
local Cache="$CacheDir/$WorkshopID"
|
||||||
local Downl="$DownloadMapsDir/$WorkshopID"
|
local Downl="$DownloadDir/$WorkshopID"
|
||||||
local Url="https://steamcommunity.com/sharedfiles/filedetails/?id=$WorkshopID"
|
local Url="https://steamcommunity.com/sharedfiles/filedetails/?id=$WorkshopID"
|
||||||
if [[ -d "$Cache" ]]; then
|
local WsName=$(name_by_workshopID "$WorkshopID")
|
||||||
local MapName=$(find "$Cache" -type f -name '*.kfm' -printf '%f\n' | head -n 1)
|
if [[ -n "$WsName" ]]; then
|
||||||
|
local WsSize=$(du -sch "$Downl" "$Cache" | tail -n 1 | grep -Po '^[^\s]+')
|
||||||
else
|
else
|
||||||
local MapName=""
|
local WsSize="-"; WsName="-"
|
||||||
fi
|
fi
|
||||||
if [[ -n "$MapName" ]]; then
|
echo "$WorkshopID $WsName $WsSize $Url"
|
||||||
local MapSize=$(du -sch "$Downl" "$Cache" | tail -n 1 | grep -Po '^[^\s]+')
|
|
||||||
else
|
|
||||||
local MapSize="-"; MapName="-"
|
|
||||||
fi
|
|
||||||
echo "$MapName $MapSize $WorkshopID $Url"
|
|
||||||
done < "$1"
|
done < "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function map_list_full () # $1: MaplistFile
|
function workshop_list_full () # $1: WorkshoplistFile
|
||||||
{
|
{
|
||||||
echo "NAME SIZE WORKSHOP_ID WORKSHOP_URL"
|
echo "WORKSHOP_ID NAME SIZE WORKSHOP_URL"
|
||||||
map_list_body "$1" | sort -k 1
|
workshop_list_body "$1" | sort -k 2
|
||||||
}
|
}
|
||||||
|
|
||||||
function map_list () # $1: [--human-readable]
|
function workshop_list () # $1: [--human-readable]
|
||||||
{
|
{
|
||||||
local MapList=$(mktemp)
|
local WsList=$(mktemp)
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
||||||
grep -F 'ServerSubscribedWorkshopItems=' "$Config" | sed -r 's/^.+=([0-9]+)$/\1/' >> "$MapList"
|
if multini -gq "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems"; then
|
||||||
|
multini -g "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" >> "$WsList"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
sort -u "$MapList" -o "$MapList"
|
sort -u "$WsList" -o "$WsList"
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
map_list_full "$MapList" | column -t
|
workshop_list_full "$WsList" | column -t
|
||||||
else
|
else
|
||||||
cat "$MapList"
|
cat "$WsList"
|
||||||
fi
|
fi
|
||||||
rm -f "$MapList"
|
rm -f "$WsList"
|
||||||
}
|
}
|
||||||
|
|
||||||
function any_to_workshopID () # $1: WorkshopID/URL
|
function any_to_workshopID () # $1: WorkshopID/URL
|
||||||
@ -661,80 +676,76 @@ function any_to_workshopID () # $1: WorkshopID/URL
|
|||||||
echo "$WorkshopID"
|
echo "$WorkshopID"
|
||||||
}
|
}
|
||||||
|
|
||||||
function map_add () # $*: WorkshopID[s]
|
function workshop_add () # $*: WorkshopID[s]
|
||||||
{
|
{
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
||||||
if ! grep -qF '[OnlineSubsystemSteamworks.KFWorkshopSteamworks]' "$Config"; then
|
multini -ar "$Config" "IpDrv.TcpNetDriver" "DownloadManagers" "OnlineSubsystemSteamworks.SteamWorkshopDownload"
|
||||||
echo -e '
|
|
||||||
|
|
||||||
[OnlineSubsystemSteamworks.KFWorkshopSteamworks]' >> "$Config"
|
|
||||||
fi
|
|
||||||
if ! grep -qF 'DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload' "$Config"; then
|
|
||||||
sed -i --follow-symlinks -r '0,/DownloadManagers=/ s/^(DownloadManagers=.+)$/DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload
|
|
||||||
\1/' "$Config"
|
|
||||||
fi
|
|
||||||
for Map in $*
|
for Map in $*
|
||||||
do
|
do
|
||||||
local WorkshopID=$(any_to_workshopID "$Map")
|
local WorkshopID=$(any_to_workshopID "$Map")
|
||||||
local MapStr="ServerSubscribedWorkshopItems=$WorkshopID"
|
if ! multini -gq "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"; then
|
||||||
if ! grep -qF "$MapStr" "$Config"; then
|
echo "Add workshop $WorkshopID to $Instance"
|
||||||
echo "Add map $WorkshopID to $Instance"
|
multini -ar "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
|
||||||
sed -i --follow-symlinks "/^\[OnlineSubsystemSteamworks\.KFWorkshopSteamworks\]/a $MapStr" "$Config"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function map_del () # $*: WorkshopID[s]
|
function workshop_del () # $*: WorkshopID[s]
|
||||||
{
|
{
|
||||||
# TODO: Remove lines from LinuxServer-KFGame.ini
|
|
||||||
# I need "crudini" with duplicate keys support >_<
|
|
||||||
for Map in $*
|
for Map in $*
|
||||||
do
|
do
|
||||||
local WorkshopID=$(any_to_workshopID "$Map")
|
local WorkshopID=$(any_to_workshopID "$Map")
|
||||||
local Cache="$CacheMapsDir/$WorkshopID"
|
local WsName=$(name_by_workshopID "$WorkshopID")
|
||||||
local Downl="$DownloadMapsDir/$WorkshopID"
|
local Cache="$CacheDir/$WorkshopID"
|
||||||
|
local Downl="$DownloadDir/$WorkshopID"
|
||||||
echo -e "Clear cache:
|
echo -e "Clear cache:
|
||||||
$Cache
|
$Cache
|
||||||
$Downl"
|
$Downl"
|
||||||
rm -rf "$Cache" "$Downl"
|
rm -rf "$Cache" "$Downl"
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
local ConfigEngine="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
|
||||||
local MapStr="ServerSubscribedWorkshopItems=$WorkshopID"
|
multini -d "$ConfigEngine" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
|
||||||
if grep -qF "$MapStr" "$Config"; then
|
if echo "$WsName" | grep -qP '\.kfm$' ; then
|
||||||
echo "Remove map $WorkshopID from $Instance"
|
echo "Remove map $WorkshopID ($WsName) from $Instance"
|
||||||
sed -i --follow-symlinks "/$MapStr/d" "$Config"
|
local WsNameShort=$(echo "$WsName" | sed 's/\.kfm$//')
|
||||||
|
local ConfigGame="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
|
multini -d "$ConfigGame" "$WsNameShort KFMapSummary"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function map_sync ()
|
function workshop_sync ()
|
||||||
{
|
{
|
||||||
map_add $(map_list)
|
workshop_add $(workshop_list)
|
||||||
|
|
||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
if instance_exists "$Instance"; then
|
if instance_exists "$Instance"; then
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
for MapFile in $(find -L "$CacheMapsDir" -type f -name '*.kfm' -printf "%f\n")
|
for MapFile in $(find -L "$CacheDir" -type f -name '*.kfm' -printf "%f\n")
|
||||||
do
|
do
|
||||||
MapName=$(echo "$MapFile" | sed -r 's|.kfm$||g')
|
MapName=$(echo "$MapFile" | sed -r 's|.kfm$||')
|
||||||
if [[ ! -f "$Config" ]]; then
|
if ! multini -gq "$Config" "$MapName KFMapSummary"; then
|
||||||
echo "$Config does not exist!"
|
|
||||||
elif ! grep -qP "MapName=$MapName[ ]*$" "$Config"; then
|
|
||||||
echo "Adding $MapName to $Instance."
|
echo "Adding $MapName to $Instance."
|
||||||
echo -e "
|
multini -s "$Config" "$MapName KFMapSummary" "MapName" "$MapName"
|
||||||
[$MapName KFMapSummary]
|
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInSurvival" "True"
|
||||||
MapName=$MapName
|
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInWeekly" "True"
|
||||||
bPlayableInSurvival=True
|
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInVsSurvival" "True"
|
||||||
bPlayableInWeekly=True
|
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInEndless" "True"
|
||||||
bPlayableInVsSurvival=True
|
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInObjective" "False"
|
||||||
bPlayableInEndless=True
|
fi
|
||||||
bPlayableInObjective=False" >> "$Config"
|
done
|
||||||
|
for MutFile in $(find -L "$CacheDir" -type f -name '*.u' -printf "%f\n")
|
||||||
|
do
|
||||||
|
MutName=$(echo "$MutFile" | sed -r 's|.u$||')
|
||||||
|
if ! multini -gq "$Config" "$MutName KFMutatorSummary"; then
|
||||||
|
echo "Adding $MutName to $Instance."
|
||||||
|
multini -s "$Config" "$MutName KFMutatorSummary" "ClassName" ""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@ -826,7 +837,9 @@ function ban_list () # $1: [--human-readable]
|
|||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
grep -P 'BannedIDs=' "$Config" | sed -r 's/.+A=([0-9]+),.+/\1/' >> "$BanList"
|
if multini -gq "$Config" "Engine.AccessControl" "BannedIDs"; then
|
||||||
|
multini -g "$Config" "Engine.AccessControl" "BannedIDs" | sed -r 's/.+A=([0-9]+),.+/\1/' >> "$BanList"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
sort -u "$BanList" -o "$BanList"
|
sort -u "$BanList" -o "$BanList"
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
@ -843,10 +856,10 @@ function ban_ID3 () # $1: ID3
|
|||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
local BanStr="BannedIDs=(Uid=(A=$ID3,B=$StrangeConstUID))"
|
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
|
||||||
if ! grep -qF "$BanStr" "$Config"; then
|
if ! multini -gq "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"; then
|
||||||
echo "Add ban $ID3 to $Instance"
|
echo "Add ban $ID3 to $Instance"
|
||||||
sed -i --follow-symlinks "/^\[Engine\.AccessControl\]/a $BanStr" "$Config"
|
multini -a "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -857,10 +870,10 @@ function unban_ID3 () # $1: ID3
|
|||||||
for Instance in $(show_instances)
|
for Instance in $(show_instances)
|
||||||
do
|
do
|
||||||
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
|
||||||
local BanStr="BannedIDs=(Uid=(A=$ID3,B=$StrangeConstUID))"
|
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
|
||||||
if grep -qF "$BanStr" "$Config"; then
|
if multini -gq "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"; then
|
||||||
echo "Remove ban $ID3 from $Instance"
|
echo "Remove ban $ID3 from $Instance"
|
||||||
sed -i --follow-symlinks "/$BanStr/d" "$Config"
|
multini -d "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -923,8 +936,8 @@ 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"
|
||||||
DownloadMapsDir="$InstallDir/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
DownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
|
||||||
CacheMapsDir="$InstallDir/KFGame/Cache"
|
CacheDir="$InstallDir/KFGame/Cache"
|
||||||
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"
|
||||||
@ -943,10 +956,10 @@ case $1 in
|
|||||||
-rs|--restart ) if [[ "$EUID" -eq 0 ]]; then shift; restart_instance $*; else run_as_root $*; fi ;;
|
-rs|--restart ) if [[ "$EUID" -eq 0 ]]; then shift; restart_instance $*; else run_as_root $*; fi ;;
|
||||||
-en|--enable ) if [[ "$EUID" -eq 0 ]]; then shift; enable_instance $*; else run_as_root $*; fi ;;
|
-en|--enable ) if [[ "$EUID" -eq 0 ]]; then shift; enable_instance $*; else run_as_root $*; fi ;;
|
||||||
-di|--disable ) if [[ "$EUID" -eq 0 ]]; then shift; disable_instance $*; else run_as_root $*; fi ;;
|
-di|--disable ) if [[ "$EUID" -eq 0 ]]; then shift; disable_instance $*; else run_as_root $*; fi ;;
|
||||||
-ml|--map-list ) if [[ "$EUID" -eq 0 ]]; then shift; map_list "-h" ; else run_as_root $*; fi ;;
|
-wl|--workshop-list ) if [[ "$EUID" -eq 0 ]]; then shift; workshop_list "-h" ; else run_as_root $*; fi ;;
|
||||||
-ms|--map-sync ) if [[ "$EUID" -eq 0 ]]; then shift; map_sync ; else run_as_root $*; fi ;;
|
-wa|--workshop-add ) if [[ "$EUID" -eq 0 ]]; then shift; workshop_add $*; else run_as_root $*; fi ;;
|
||||||
-ma|--map-add ) if [[ "$EUID" -eq 0 ]]; then shift; map_add $*; else run_as_root $*; fi ;;
|
-wd|--workshop-del ) if [[ "$EUID" -eq 0 ]]; then shift; workshop_del $*; else run_as_root $*; fi ;;
|
||||||
-md|--map-del ) if [[ "$EUID" -eq 0 ]]; then shift; map_del $*; else run_as_root $*; fi ;;
|
-ws|--workshop-sync ) if [[ "$EUID" -eq 0 ]]; then shift; workshop_sync ; else run_as_root $*; fi ;;
|
||||||
-mrs|--map-rotate-save ) if [[ "$EUID" -eq 0 ]]; then shift; map_rotate_save $*; else run_as_root $*; fi ;;
|
-mrs|--map-rotate-save ) if [[ "$EUID" -eq 0 ]]; then shift; map_rotate_save $*; else run_as_root $*; fi ;;
|
||||||
-mrl|--map-rotate-load ) if [[ "$EUID" -eq 0 ]]; then shift; map_rotate_load $*; else run_as_root $*; fi ;;
|
-mrl|--map-rotate-load ) if [[ "$EUID" -eq 0 ]]; then shift; map_rotate_load $*; else run_as_root $*; fi ;;
|
||||||
-bl|--ban-list ) if [[ "$EUID" -eq 0 ]]; then shift; ban_list "-h" ; else run_as_root $*; fi ;;
|
-bl|--ban-list ) if [[ "$EUID" -eq 0 ]]; then shift; ban_list "-h" ; else run_as_root $*; fi ;;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=Check and Update killing Floor 2 beta job
|
Description=Check and Update killing Floor 2 beta job
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=*-*-* 4:00:00
|
OnCalendar=Wed, 04:00
|
||||||
Unit=kf2-srv-beta-update.service
|
Unit=kf2-srv-beta-update.service
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Description=Check and Update killing Floor 2 job
|
Description=Check and Update killing Floor 2 job
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=*-*-* 4:00:00
|
OnCalendar=Wed, 04:00
|
||||||
Unit=kf2-srv-update.service
|
Unit=kf2-srv-update.service
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
LANG=en_US.UTF-8
|
LANG=en_US.UTF-8
|
||||||
|
|
||||||
PortW="-webadminport=8080"
|
PortW=-webadminport=8080
|
||||||
PortQ="-queryport=27015"
|
PortQ=-queryport=27015
|
||||||
PortG="-port=7777"
|
PortG=-port=7777
|
||||||
|
|
||||||
# First arg: map name
|
# First arg: map name
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%global steamuser steam
|
%global steamuser steam
|
||||||
|
|
||||||
Name: kf2-srv
|
Name: kf2-srv
|
||||||
Version: 0.7.0
|
Version: 0.8.0
|
||||||
Release: 1%{dist}
|
Release: 1%{dist}
|
||||||
Summary: Killing Floor 2 server
|
Summary: Killing Floor 2 server
|
||||||
Group: Amusements/Games
|
Group: Amusements/Games
|
||||||
@ -31,6 +31,7 @@ Requires: util-linux
|
|||||||
Requires: sudo
|
Requires: sudo
|
||||||
Requires: psmisc
|
Requires: psmisc
|
||||||
Requires: gawk
|
Requires: gawk
|
||||||
|
Requires: multini >= 0.2
|
||||||
|
|
||||||
Provides: %{name}
|
Provides: %{name}
|
||||||
|
|
||||||
@ -89,6 +90,12 @@ if [[ $1 -eq 0 ]] ; then # Uninstall
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Apr 27 2020 GenZmeY <genzmey@gmail.com> - 0.8.0-1
|
||||||
|
- use multini for ini edit;
|
||||||
|
- add mutators support;
|
||||||
|
- refactoring;
|
||||||
|
- returned "reboot-updates".
|
||||||
|
|
||||||
* Sat Mar 7 2020 GenZmeY <genzmey@gmail.com> - 0.7.0-1
|
* Sat Mar 7 2020 GenZmeY <genzmey@gmail.com> - 0.7.0-1
|
||||||
- dual versions support;
|
- dual versions support;
|
||||||
- check updates;
|
- check updates;
|
||||||
|
Loading…
Reference in New Issue
Block a user