Compare commits

..

2 Commits

Author SHA1 Message Date
bc4493d042 Wed May 27 2020 2020-07-09 01:59:33 +03:00
1f2a50b164 Mon Apr 27 2020 2020-07-09 01:58:10 +03:00
8 changed files with 544 additions and 224 deletions

View File

@ -17,24 +17,22 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
declare -a DiffArray
declare -a WaveArray
declare -A ModeArray
source /etc/steamcmd/steamcmd.conf
source /etc/kf2-srv/kf2-srv.conf
ScriptFullname=$(readlink -e "$0")
ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
ScriptVersion="0.7.0"
ScriptVersion="0.9.0"
# Constants. Don't change.
AppServerNum="232130"
AppClientNum="232090"
StrangeConstUID="17825793"
DiffArray=('Normal' 'Hard' 'Suicide' 'Hell')
WaveArray=('4' '7' '10')
declare -A ModeArray
ModeArray['KFGameContent.KFGameInfo_Survival']='Survival'
ModeArray['KFGameContent.KFGameInfo_WeeklySurvival']='Weekly'
ModeArray['KFGameContent.KFGameInfo_Endless']='Endless'
ModeArray['KFGameContent.KFGameInfo_Objective']='Objective'
ModeArray['KFGameContent.KFGameInfo_VersusSurvival']='Versus'
ServerBotLogin="srvbot"
function show_help ()
{
@ -59,6 +57,7 @@ function show_help ()
echo " необходимости перекачивает их."
echo " -r, --run [OPTIONS] запускает экземпляр сервера с указанными"
echo " ПАРАМЕТРАМИ"
echo " -c, --chat MSG [INSTANCE] отправляет сообщение в чат указанных экземпляров"
echo " -st, --start [INSTANCE] запускает указанный ЭКЗЕМПЛЯР сервера; если"
echo " ЭКЗЕМПЛЯР не указан, запускает все"
echo " автозапускаемые экземпляры сервера"
@ -74,14 +73,14 @@ function show_help ()
echo " -di, --disable [INSTANCE] удаляет указанный ЭКЗЕМПЛЯР сервера из"
echo " автозапуска; если ЭКЗЕМПЛЯР не указан,"
echo " удаляет все экземпляры сервера из автозапуска"
echo " -ml, --map-list отображает список карт из SteamWorkshop"
echo " -ms, --map-sync синхронизирует списки сторонних карт в"
echo " -wl, --workshop-list отображает список ресурсов из SteamWorkshop"
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 " 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 " указанного ЭКЗЕМПЛЯРА сервера; если ЭКЗЕМПЛЯР"
echo " не указан, сохраняет порядок для всех ЭКЗЕМПЛЯРОВ"
@ -98,6 +97,10 @@ function show_help ()
echo " -bd, --ban-del [BAN_ID] удаляет пользователя из списка заблокированных"
echo " допустимо использовать ID3, SteamID, а также"
echo " ссылку на профиль пользователя"
echo " -fp, --fix-permissions [INSTANCE] поправить права на ini файлы"
echo " -as, --admin-sync синхронизировать всех админов (заглушка)"
echo " -pg, --password-game PASSWORD [INSTANCE] установить пароль игры для экземпляров"
echo " -pa, --password-admin PASSWORD [INSTANCE] установить пароль админа для экземпляров"
echo " -h, --help display this help and exit"
}
@ -163,7 +166,8 @@ function server_exists ()
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
local BetaArg="-beta preview"
fi
@ -197,9 +201,9 @@ function new_instance () # $*: InstanceName[s]
for Instance in $(show_instances)
do
local Config="$InstanceConfigDir/$Instance/main.conf"
local GamePort=$(grep -Po '"-port=([0-9]+)' "$Config" | grep -Po '[0-9]+$')
local WebAdminPort=$(grep -Po '"-webadminport=([0-9]+)' "$Config" | grep -Po '[0-9]+$')
local QueryPort=$(grep -Po '"-queryport=([0-9]+)' "$Config" | grep -Po '[0-9]+$')
local GamePort=$(multini --get "$Config" '' 'PortGame')
local WebAdminPort=$(multini --get "$Config" '' 'PortWeb')
local QueryPort=$(multini --get "$Config" '' 'PortQuery')
if [[ "$GamePort" -gt "$MaxGamePort" ]]; then MaxGamePort="$GamePort"; fi
if [[ "$QueryPort" -gt "$MaxQueryPort" ]]; then MaxQueryPort="$QueryPort"; fi
if [[ "$WebAdminPort" -gt "$MaxWebAdminPort" ]]; then MaxWebAdminPort="$WebAdminPort"; fi
@ -223,6 +227,8 @@ function new_instance () # $*: InstanceName[s]
install $FileMode "$MainConfigTemplate" "$InstanceDir/main.conf"
install $FileMode "$DefaultConfigDir/KFAI.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/KFWeb.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/KFWebAdmin.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/KFMultiAdmin.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/LinuxServer-KFEngine.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/LinuxServer-KFGame.ini" "$InstanceDir"
install $FileMode "$DefaultConfigDir/LinuxServer-KFInput.ini" "$InstanceDir"
@ -234,9 +240,9 @@ function new_instance () # $*: InstanceName[s]
((MaxGamePort++)); ((MaxQueryPort++)); ((MaxWebAdminPort++))
sed -i -r --follow-symlinks "s/-port=[0-9]+/-port=$MaxGamePort/g" "$InstanceDir/main.conf"
sed -i -r --follow-symlinks "s/-queryport=[0-9]+/-queryport=$MaxQueryPort/g" "$InstanceDir/main.conf"
sed -i -r --follow-symlinks "s/-webadminport=[0-9]+/-webadminport=$MaxWebAdminPort/g" "$InstanceDir/main.conf"
multini -s "$InstanceDir/main.conf" '' 'PortGame' "$MaxGamePort"
multini -s "$InstanceDir/main.conf" '' 'PortQuery' "$MaxQueryPort"
multini -s "$InstanceDir/main.conf" '' 'PortWeb' "$MaxWebAdminPort"
echo "Instance $Instance created. See /etc/$ScriptName/instances$BetaPostfix/$Instance for edit configuration"
done
@ -285,31 +291,37 @@ function show_status_implementation_body () # $*: [InstanceName[s]]
local IsRuning="stopped"
fi
local Description=$(grep -P 'Description=' "$InstanceConfigDir/$Instance/main.conf" | sed -r 's/(Description=|")//g')
local GamePort=$(grep -Po '"-port=([0-9]+)' "$InstanceConfigDir/$Instance/main.conf" | grep -Po '[0-9]+$')
local WebAdminPort=$(grep -Po '"-webadminport=([0-9]+)' "$InstanceConfigDir/$Instance/main.conf" | grep -Po '[0-9]+$')
local QueryPort=$(grep -Po '"-queryport=([0-9]+)' "$InstanceConfigDir/$Instance/main.conf" | grep -Po '[0-9]+$')
local GameType=$(grep -Po 'Game=([^\?]+)' "$InstanceConfigDir/$Instance/main.conf" | sed -r 's/Game=([^?]+)/\1/g' )
local GameLength=$(grep -Po 'GameLength=([0-9]+)' "$InstanceConfigDir/$Instance/main.conf" | grep -Po '[0-9]+$')
local GameDifficulty=$(grep -Po 'Difficulty=([0-9]+)' "$InstanceConfigDir/$Instance/main.conf" | grep -Po '[0-9]+$')
local Comment=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Comment")
local GamePort=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "PortGame")
local WebAdminPort=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "PortWeb")
local QueryPort=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "PortQuery")
local GameType=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Game")
local GameLength=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Length")
local GameDifficulty=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Difficulty")
local Map=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Map")
local Args=$( multini -g "$InstanceConfigDir/$Instance/main.conf" '' "Args")
local DisplayGameType=${ModeArray[$GameType]}
local DisplayGameLength=${WaveArray[$GameLength]}
local DisplayDifficulty=${DiffArray[$GameDifficulty]}
if [[ "$DisplayGameType" == 'Weekly' || \
"$DisplayGameType" == 'Endless' || \
"$DisplayGameType" == 'Versus' || \
"$DisplayGameType" == 'Objective' ]]; then
if [[ -z "$DisplayGameType" ]]; then
DisplayGameType="$GameType"
fi
if [[ "$GameType" == 'KFGameContent.KFGameInfo_WeeklySurvival' || \
"$GameType" == 'KFGameContent.KFGameInfo_Endless' || \
"$GameType" == 'KFGameContent.KFGameInfo_VersusSurvival' || \
"$GameType" == 'KFGameContent.KFGameInfo_Objective' ]]; then
DisplayGameLength='-'
fi
if [[ "$DisplayGameType" == 'Weekly' || \
"$DisplayGameType" == 'Versus' ]]; then
if [[ "$GameType" == 'KFGameContent.KFGameInfo_WeeklySurvival' || \
"$DisplayGameType" == 'KFGameContent.KFGameInfo_VersusSurvival' ]]; then
DisplayDifficulty='-'
fi
echo -e "$Instance:$IsEnabled:$IsRuning:$GamePort:$QueryPort:$WebAdminPort:$DisplayGameType:$DisplayGameLength:$DisplayDifficulty:$Description"
echo -e "$Instance:$IsEnabled:$IsRuning:$GamePort:$QueryPort:$WebAdminPort:$DisplayGameType:$DisplayGameLength:$DisplayDifficulty:$Args:$Comment"
done
}
@ -327,7 +339,7 @@ function show_status_implementation_full () # $*: [InstanceName[s]]
done
fi
echo -e "INSTANCE:AUTORUN:STATE:P_GAME:P_QUERY:P_WEB:TYPE:LEN:DIFF:DESCRIPTION"
echo -e "INSTANCE:AUTORUN:STATE:P_GAME:P_QUERY:P_WEB:TYPE:LEN:DIFF:ARGS:COMMENT"
show_status_implementation_body "$InstanceList" | sort -t : -k 4
}
@ -343,42 +355,21 @@ function validate ()
fi
stop_instance
steamcmd +login $SteamLogin +force_install_dir $InstallDir +app_update $AppServerNum $BetaArg validate +exit
fix_steamclient_so
start_instance
}
function make_default_instance ()
function make_default_instance () # $1: Dir
{
local InstanceDir="$InstanceConfigDir/default"
chmod 664 \
"$DefaultConfigDir/KFAI.ini" \
"$DefaultConfigDir/KFWeb.ini" \
"$DefaultConfigDir/LinuxServer-KFEngine.ini" \
"$DefaultConfigDir/LinuxServer-KFGame.ini" \
"$DefaultConfigDir/LinuxServer-KFInput.ini" \
"$DefaultConfigDir/LinuxServer-KFSystemSettings.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerEngine.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerGame.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerInput.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerSystemSettings.ini"
dos2unix \
"$DefaultConfigDir/KFAI.ini" \
"$DefaultConfigDir/KFWeb.ini" \
"$DefaultConfigDir/LinuxServer-KFEngine.ini" \
"$DefaultConfigDir/LinuxServer-KFGame.ini" \
"$DefaultConfigDir/LinuxServer-KFInput.ini" \
"$DefaultConfigDir/LinuxServer-KFSystemSettings.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerEngine.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerGame.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerInput.ini" \
"$DefaultConfigDir/LinuxServer/LinuxServerSystemSettings.ini"
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir"
install -d -g "$SteamUser" -o "$SteamUser" -m 775 "$InstanceDir/LinuxServer"
install -g "$SteamUser" -o "$SteamUser" -m 664 "$MainConfigTemplate" "$InstanceDir/main.conf"
ln -s "$DefaultConfigDir/KFAI.ini" "$InstanceDir/KFAI.ini"
ln -s "$DefaultConfigDir/KFWeb.ini" "$InstanceDir/KFWeb.ini"
ln -s "$DefaultConfigDir/KFWebAdmin.ini" "$InstanceDir/KFWebAdmin.ini"
ln -s "$DefaultConfigDir/KFMultiAdmin.ini" "$InstanceDir/KFMultiAdmin.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-KFInput.ini" "$InstanceDir/LinuxServer-KFInput.ini"
@ -387,6 +378,36 @@ function make_default_instance ()
ln -s "$DefaultConfigDir/LinuxServer/LinuxServerGame.ini" "$InstanceDir/LinuxServer/LinuxServerGame.ini"
ln -s "$DefaultConfigDir/LinuxServer/LinuxServerInput.ini" "$InstanceDir/LinuxServer/LinuxServerInput.ini"
ln -s "$DefaultConfigDir/LinuxServer/LinuxServerSystemSettings.ini" "$InstanceDir/LinuxServer/LinuxServerSystemSettings.ini"
fix_ini_permissions "$InstanceDir"
fix_ini_eol "$InstanceDir"
}
function fix_permissions () # $*: Instance[s]
{
local InstanceList="$*"
if [[ -z "$InstanceList" ]] ; then
fix_ini_permissions "$InstanceConfigDir"
else
for Instance in $InstanceList
do
fix_ini_permissions "$InstanceConfigDir/$Instance"
done
fi
}
function fix_ini_permissions () # $1: Dir
{
find "$1" \( -type l -o -type f \) -name '*.ini' | \
xargs --max-procs=$(nproc) -I {} \
sh -c "chmod 664 {}; chown $SteamUser:$SteamUser {}"
}
function fix_ini_eol () # $1: Dir
{
find "$1" \( -type l -o -type f \) -name '*.ini' | \
xargs --max-procs=$(nproc) -I {} \
sh -c "dos2unix -F {}"
}
function fix_steamclient_so ()
@ -404,43 +425,44 @@ function create_map_dirs ()
# space saving
local InstallDirOrig="/usr/games/kf2-srv"
local InstallDirBeta="/usr/games/kf2-srv-beta"
local DownloadMapsDirOrig="$InstallDirOrig/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
local CacheMapsDirOrig="$InstallDirOrig/KFGame/Cache"
local DownloadMapsDirBeta="$InstallDirBeta/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
local CacheMapsDirBeta="$InstallDirBeta/KFGame/Cache"
local DownloadDirOrig="$InstallDirOrig/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
local CacheDirOrig="$InstallDirOrig/KFGame/Cache"
local DownloadDirBeta="$InstallDirBeta/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
local CacheDirBeta="$InstallDirBeta/KFGame/Cache"
if [[ -z "$BetaPostfix" ]]; then # Orig
sudo -u "$SteamUser" install -d -m 775 "$DownloadMapsDirOrig"
if [[ -d "$CacheMapsDirBeta" ]]; then
ln -s "$CacheMapsDirBeta" "$CacheMapsDirOrig"
rm -rf "$DownloadMapsDirOrig"
ln -s "$DownloadMapsDirBeta" "$DownloadMapsDirOrig"
sudo -u "$SteamUser" install -d -m 775 "$DownloadDirOrig"
if [[ -d "$CacheDirBeta" ]]; then
ln -s "$CacheDirBeta" "$CacheDirOrig"
rm -rf "$DownloadDirOrig"
ln -s "$DownloadDirBeta" "$DownloadDirOrig"
else
sudo -u "$SteamUser" install -d -m 775 "$CacheMapsDirOrig"
sudo -u "$SteamUser" install -d -m 775 "$CacheDirOrig"
fi
else # Beta
sudo -u "$SteamUser" install -d -m 775 "$DownloadMapsDirBeta"
if [[ -d "$CacheMapsDirOrig" ]]; then
ln -s "$CacheMapsDirOrig" "$CacheMapsDirBeta"
rm -rf "$DownloadMapsDirBeta"
ln -s "$DownloadMapsDirOrig" "$DownloadMapsDirBeta"
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 "$CacheMapsDirBeta"
sudo -u "$SteamUser" install -d -m 775 "$CacheDirBeta"
fi
fi
}
function update_kf2 ()
function first_install ()
{
if [[ -n "$BetaPostfix" ]]; then
local BetaArg="-beta preview"
fi
if ! server_exists; then # First install
# TODO: Replace killall
# kill -INT $PID?
# sudo is stopping me from knowing pid
if ! steamcmd +login $SteamLogin +force_install_dir $InstallDir +app_update $AppServerNum $BetaArg validate +exit; then
echo "Errors during installation - exit"
exit 1
fi
sudo -u "$SteamUser" $AppBin &
echo "Creating base ini files"
sudo -u "$SteamUser" $AppBin &> /dev/null &
while true
do
if [[ -e "$DefaultConfigDir/KFAI.ini" ]] &&
@ -456,18 +478,86 @@ function update_kf2 ()
break
fi
sleep 2
# TODO: KFWeb.ini > webadmin=true
done
killall -KILL KFGameSteamServer.bin.x86_64
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
echo "Setting up WebAdmin"
multini -s "$DefaultConfigDir/KFWeb.ini" "IpDrv.WebServer" "bEnabled" "true"
sudo -u "$SteamUser" $AppBin &> /dev/null &
while true
do
if [[ -e "$DefaultConfigDir/KFWebAdmin.ini" ]]; then
break
fi
sleep 2
done
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" "bHttpAuth" "True"
echo "Wait while WebAdmin up"
sudo -u "$SteamUser" $AppBin &> /dev/null &
while ! curl -s -o "/dev/null" -u "Admin:Admin" "localhost:8080"
do
sleep 2
done
echo "Setting up server bot"
while ! curl -s -o "/dev/null" \
-u "Admin:Admin" \
"localhost:8080/ServerAdmin/multiadmin" \
--request POST \
--data adminid="$ServerBotLogin" \
--data action="create"
do sleep 2; done
while ! multini -gq \
"$DefaultConfigDir/KFMultiAdmin.ini" \
"$ServerBotLogin MultiAdminData" \
"Password"
do sleep 2; done
while ! curl -s -o "/dev/null" \
-u "Admin:Admin" \
"localhost:8080/ServerAdmin/multiadmin" \
--request POST \
--data adminid="$ServerBotLogin" \
--data displayname="ServerBot" \
--data enabled=1 \
--data password1="$ServerBotPassword" \
--data password2="$ServerBotPassword" \
--data order="DenyAllow" \
--data deny= \
--data allow= \
--data action="save"
do sleep 2; done
while [[ -z $(multini -g \
"$DefaultConfigDir/KFMultiAdmin.ini" \
"$ServerBotLogin MultiAdminData" \
"Password") ]]
do sleep 2; done
killall -KILL KFGameSteamServer.bin.x86_64; sleep 1
create_map_dirs
fix_steamclient_so
ln -s "$InstanceConfigDir" "$InstanceConfigLnk"
make_default_instance
echo "KF2 succesfully installed"
elif updates_aviable; then # Update
}
function update_kf2 ()
{
if [[ -n "$BetaPostfix" ]]; then
local BetaArg="-beta preview"
fi
if ! server_exists; then
first_install
elif updates_aviable; then
stop_instance
steamcmd +login $SteamLogin +force_install_dir $InstallDir +app_update $AppServerNum $BetaArg +exit
start_instance
else
echo "Server is up to date"
fi
}
@ -607,48 +697,61 @@ function run ()
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
do
local Cache="$CacheMapsDir/$WorkshopID"
local Downl="$DownloadMapsDir/$WorkshopID"
local Cache="$CacheDir/$WorkshopID"
local Downl="$DownloadDir/$WorkshopID"
local Url="https://steamcommunity.com/sharedfiles/filedetails/?id=$WorkshopID"
if [[ -d "$Cache" ]]; then
local MapName=$(find "$Cache" -type f -name '*.kfm' -printf '%f\n' | head -n 1)
local WsName=$(name_by_workshopID "$WorkshopID")
if [[ -n "$WsName" ]]; then
local WsSize=$(du -sch "$Downl" "$Cache" | tail -n 1 | grep -Po '^[^\s]+')
else
local MapName=""
local WsSize="-"; WsName="-"
fi
if [[ -n "$MapName" ]]; then
local MapSize=$(du -sch "$Downl" "$Cache" | tail -n 1 | grep -Po '^[^\s]+')
else
local MapSize="-"; MapName="-"
fi
echo "$MapName $MapSize $WorkshopID $Url"
echo "$WorkshopID $WsName $WsSize $Url"
done < "$1"
}
function map_list_full () # $1: MaplistFile
function workshop_list_full () # $1: WorkshoplistFile
{
echo "NAME SIZE WORKSHOP_ID WORKSHOP_URL"
map_list_body "$1" | sort -k 1
echo "WORKSHOP_ID NAME SIZE WORKSHOP_URL"
workshop_list_body "$1" | sort -k 2
}
function map_list () # $1: [--human-readable]
function workshop_list () # $1: [--human-readable]
{
local MapList=$(mktemp)
# TODO: Multiple *.kfm/*u in folder
local WsList=$(mktemp)
for Instance in $(show_instances)
do
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
grep -F 'ServerSubscribedWorkshopItems=' "$Config" | sed -r 's/^.+=([0-9]+)$/\1/' >> "$MapList"
done
sort -u "$MapList" -o "$MapList"
if [[ -n "$1" ]]; then
map_list_full "$MapList" | column -t
else
cat "$MapList"
if multini -gq "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems"; then
multini -g "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" >> "$WsList"
fi
rm -f "$MapList"
done
sort -u "$WsList" -o "$WsList"
if [[ -n "$1" ]]; then
workshop_list_full "$WsList" | column -t
else
cat "$WsList"
fi
rm -f "$WsList"
}
function any_to_workshopID () # $1: WorkshopID/URL
@ -661,84 +764,85 @@ function any_to_workshopID () # $1: WorkshopID/URL
echo "$WorkshopID"
}
function map_add () # $*: WorkshopID[s]
function workshop_add () # $*: WorkshopID[s]
{
for Instance in $(show_instances)
do
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
if ! grep -qF '[OnlineSubsystemSteamworks.KFWorkshopSteamworks]' "$Config"; then
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
multini -ar "$Config" "IpDrv.TcpNetDriver" "DownloadManagers" "OnlineSubsystemSteamworks.SteamWorkshopDownload"
for Map in $*
do
local WorkshopID=$(any_to_workshopID "$Map")
local MapStr="ServerSubscribedWorkshopItems=$WorkshopID"
if ! grep -qF "$MapStr" "$Config"; then
echo "Add map $WorkshopID to $Instance"
sed -i --follow-symlinks "/^\[OnlineSubsystemSteamworks\.KFWorkshopSteamworks\]/a $MapStr" "$Config"
if ! multini -gq "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"; then
echo "Add workshop $WorkshopID to $Instance"
multini -ar "$Config" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
fi
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 $*
do
local WorkshopID=$(any_to_workshopID "$Map")
local Cache="$CacheMapsDir/$WorkshopID"
local Downl="$DownloadMapsDir/$WorkshopID"
local WsName=$(name_by_workshopID "$WorkshopID")
local Cache="$CacheDir/$WorkshopID"
local Downl="$DownloadDir/$WorkshopID"
echo -e "Clear cache:
$Cache
$Downl"
rm -rf "$Cache" "$Downl"
for Instance in $(show_instances)
do
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
local MapStr="ServerSubscribedWorkshopItems=$WorkshopID"
if grep -qF "$MapStr" "$Config"; then
echo "Remove map $WorkshopID from $Instance"
sed -i --follow-symlinks "/$MapStr/d" "$Config"
local ConfigEngine="$InstanceConfigDir/$Instance/LinuxServer-KFEngine.ini"
multini -d "$ConfigEngine" "OnlineSubsystemSteamworks.KFWorkshopSteamworks" "ServerSubscribedWorkshopItems" "$WorkshopID"
if echo "$WsName" | grep -qP '\.kfm$' ; then
echo "Remove map $WorkshopID ($WsName) from $Instance"
local WsNameShort=$(echo "$WsName" | sed 's/\.kfm$//')
local ConfigGame="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
multini -d "$ConfigGame" "$WsNameShort KFMapSummary"
fi
done
done
}
function map_sync ()
function workshop_sync ()
{
map_add $(map_list)
workshop_add $(workshop_list)
# TODO: Make it faster
for Instance in $(show_instances)
do
if instance_exists "$Instance"; then
local Service=$(service_name "$Instance")
if ! instance_exists "$Instance"; then
echo "Instance $Instance not exitst"
elif systemctl -q is-active $Service ; then
echo "Instance $Instance is running - skip."
else
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
MapName=$(echo "$MapFile" | sed -r 's|.kfm$||g')
if [[ ! -f "$Config" ]]; then
echo "$Config does not exist!"
elif ! grep -qP "MapName=$MapName[ ]*$" "$Config"; then
MapName=$(echo "$MapFile" | sed -r 's|.kfm$||')
if ! multini -gq "$Config" "$MapName KFMapSummary"; then
echo "Adding $MapName to $Instance."
echo -e "
[$MapName KFMapSummary]
MapName=$MapName
bPlayableInSurvival=True
bPlayableInWeekly=True
bPlayableInVsSurvival=True
bPlayableInEndless=True
bPlayableInObjective=False" >> "$Config"
multini -s "$Config" "$MapName KFMapSummary" "MapName" "$MapName"
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInSurvival" "True"
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInWeekly" "True"
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInVsSurvival" "True"
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInEndless" "True"
multini -s "$Config" "$MapName KFMapSummary" "bPlayableInObjective" "False"
fi
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
done
else
echo "Instance $Instance not exitst"
fi
done
}
@ -763,6 +867,15 @@ function map_rotate_save () # $*: Instance[s]
done
}
function map_rotate_to_webstring () # $1: MapRotate
{
local RN='%0D%0A'
echo "$1" | \
sed -r 's/^\(Maps=\("//' | \
sed -r 's/"\)\)$//' | \
sed "s/\",\"/${RN}/g"
}
function map_rotate_load () # $*: Instance[s]
{
local InstanceList="$*"
@ -772,17 +885,42 @@ function map_rotate_load () # $*: Instance[s]
for Instance in $InstanceList
do
if instance_exists "$Instance"; then
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
local Service=$(service_name "$Instance")
local MapRotate="$InstanceConfigDir/$Instance/MapRotate.ini"
if [[ -e "$MapRotate" ]]; then
sed -i --follow-symlinks -r "/(ActiveMapCycle=|GameMapCycles=)/d" "$Config"
sed -i --follow-symlinks "/\[KFGame\.KFGameInfo\]/ r $MapRotate" "$Config"
else
if ! instance_exists "$Instance"; then
echo "Instance $Instance not exists"
elif ! [[ -e "$MapRotate" ]]; then
echo "$MapRotate not found - skip"
elif systemctl -q is-active $Service ; then
# TODO: Delete other cycles
# Example: maplistidx=1&mapcycle=KF-Airship%0D%0A&delete=doit
local ActiveCycleIndex=$(multini -g "$MapRotate" '' 'ActiveMapCycle')
local ActiveCycleWeb=''
local Index=0
while read MapCycle
do
local MapCycleWeb=$(map_rotate_to_webstring "$MapCycle")
admin_curl "$Instance" "ServerAdmin/settings/maplist" \
--request POST \
--data maplistidx="$Index" \
--data mapcycle="$MapCycleWeb" \
--data action="save"
if [[ "$Index" -eq "$ActiveCycleIndex" ]]; then
ActiveCycleWeb="$MapCycleWeb"
fi
((Index++))
done < <(multini -g "$MapRotate" '' 'GameMapCycles')
if [[ -n "$ActiveCycleWeb" ]]; then
admin_curl "$Instance" "ServerAdmin/settings/maplist" \
--request POST \
--data maplistidx="$ActiveCycleIndex" \
--data mapcycle="$ActiveCycleWeb" \
--data activate="activate"
fi
else
echo "Instance $Instance not exitst"
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
sed -i --follow-symlinks -r "/(ActiveMapCycle=|GameMapCycles=)/d" "$Config"
sed -i --follow-symlinks "/\[KFGame\.KFGameInfo\]/ r $MapRotate" "$Config"
fi
done
}
@ -810,12 +948,16 @@ function steamID64_to_steamID3 () # $1: ID4
function ban_list_ext () # $1: BanlistFile
{
local Num=1
echo "NUM STEAM_ID3 STEAM_ID64 PROFILE_URL"
echo "NUM STEAM_ID3 STEAM_ID64 URL_CONST URL_EFFECTIVE"
while read ID3
do
local ID64=$(steamID3_to_steamID64 "$ID3")
local Url=$(curl "https://steamcommunity.com/profiles/$ID64" -s -L -I -o /dev/null -w '%{url_effective}')
echo "$Num $ID3 $ID64 $Url"
local UrlConst="https://steamcommunity.com/profiles/$ID64"
local UrlEffective=$(curl "$UrlConst" -s -L -I -o /dev/null -w '%{url_effective}')
if [[ "$UrlConst" == "$UrlEffective" ]]; then
UrlEffective="-"
fi
echo "$Num $ID3 $ID64 $UrlConst $UrlEffective"
((Num++))
done < "$1"
}
@ -826,7 +968,9 @@ function ban_list () # $1: [--human-readable]
for Instance in $(show_instances)
do
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
sort -u "$BanList" -o "$BanList"
if [[ -n "$1" ]]; then
@ -843,10 +987,19 @@ function ban_ID3 () # $1: ID3
for Instance in $(show_instances)
do
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
local BanStr="BannedIDs=(Uid=(A=$ID3,B=$StrangeConstUID))"
if ! grep -qF "$BanStr" "$Config"; then
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
local Service=$(service_name "$Instance")
if ! multini -gq "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"; then
echo "Add ban $ID3 to $Instance"
sed -i --follow-symlinks "/^\[Engine\.AccessControl\]/a $BanStr" "$Config"
if systemctl -q is-active $Service ; then
admin_curl "$Instance" "ServerAdmin/policy/bans" \
--request POST \
--data action="add" \
--data steamint64=$(steamID3_to_steamID64 $ID3) \
--data uniqueid=
else
multini -a "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
fi
fi
done
}
@ -857,10 +1010,19 @@ function unban_ID3 () # $1: ID3
for Instance in $(show_instances)
do
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
local BanStr="BannedIDs=(Uid=(A=$ID3,B=$StrangeConstUID))"
if grep -qF "$BanStr" "$Config"; then
local BanStr="(Uid=(A=$ID3,B=$StrangeConstUID))"
local Service=$(service_name "$Instance")
if systemctl -q is-active $Service ; then
echo "Instance $Instance is running - skip."
# TODO: delete ban with webadmin/curl
# POST Body example:
# banid=plainid%3A8&action=delete
# WTF is plainID?!
else
if multini -gq "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"; then
echo "Remove ban $ID3 from $Instance"
sed -i --follow-symlinks "/$BanStr/d" "$Config"
multini -d "$Config" "Engine.AccessControl" "BannedIDs" "$BanStr"
fi
fi
done
}
@ -916,6 +1078,116 @@ function ban_sync ()
done
}
function admin_sync ()
{
# TODO: Implementation
echo "Dummy"
}
function admin_curl () # $1: Instance, $2: URL, $*: Request
{
local Instance="$1"
local URL="$2"
local MainConf="$InstanceConfigDir/$Instance/main.conf"
local WebPort=$(multini --get "$MainConf" '' "PortWeb")
shift; shift
curl -s -o "/dev/null" -u "$ServerBotLogin:$ServerBotPassword" "localhost:$WebPort/$URL" $*
}
function password_game () # $1: Password (if empty, use: ''), $*: Instance[s]
{
if echo "$1" | grep -qP '\s'; then
echo "Password should not contain spaces"
return 1
fi
local Password="$1"; shift
local InstanceList="$*"
if [[ -z "$InstanceList" ]] ; then
InstanceList=$(show_instances)
fi
for Instance in $InstanceList
do
if instance_exists "$Instance"; then
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
local Service=$(service_name "$Instance")
if systemctl -q is-active $Service ; then
admin_curl "$Instance" "ServerAdmin/policy/passwords" \
--request POST \
--data action="gamepassword" \
--data gamepw1="$Password" \
--data gamepw2="$Password"
else
multini -s "$Config" "Engine.AccessControl" "GamePassword" "$Password"
fi
else
echo "Instance $Instance not exitst"
fi
done
}
function password_admin () # $1: Password (if empty, use: ''), $*: Instance[s]
{
if echo "$1" | grep -qP '\s'; then
echo "Password should not contain spaces"
return 1
fi
local Password="$1"; shift
local InstanceList="$*"
if [[ -z "$InstanceList" ]] ; then
InstanceList=$(show_instances)
fi
for Instance in $InstanceList
do
if instance_exists "$Instance"; then
local Config="$InstanceConfigDir/$Instance/LinuxServer-KFGame.ini"
local Service=$(service_name "$Instance")
if systemctl -q is-active $Service ; then
admin_curl "$Instance" "ServerAdmin/policy/passwords" \
--request POST \
--data action="adminpassword" \
--data adminpw1="$Password" \
--data adminpw2="$Password"
else
multini -s "$Config" "Engine.AccessControl" "AdminPassword" "$Password"
fi
else
echo "Instance $Instance not exitst"
fi
done
}
function chat ()
{
local Message=$(echo "$1" | sed 's/ /+/g')
shift
local InstanceList="$*"
if [[ -z "$InstanceList" ]] ; then
InstanceList=$(show_instances)
fi
for Instance in $InstanceList
do
if instance_exists "$Instance"; then
local Service=$(service_name "$Instance")
if systemctl -q is-active $Service ; then
admin_curl "$Instance" "ServerAdmin/current/chat+frame+data" \
--request POST \
--data ajax=1 \
--data message="$Message" \
--data teamsay=-1
else
echo "Instance $Instance not running - skip"
fi
else
echo "Instance $Instance not exitst"
fi
done
}
if [[ "$1" == "beta" ]]; then
BetaPostfix="-beta"; shift
fi
@ -923,8 +1195,8 @@ fi
InstallDir="/usr/games/kf2-srv$BetaPostfix"
AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64"
DefaultConfigDir="$InstallDir/KFGame/Config"
DownloadMapsDir="$InstallDir/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
CacheMapsDir="$InstallDir/KFGame/Cache"
DownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop/content/$AppClientNum"
CacheDir="$InstallDir/KFGame/Cache"
InstanceConfigDir="/etc/kf2-srv/instances$BetaPostfix"
InstanceConfigLnk="$DefaultConfigDir/instances"
MainConfigTemplate="/etc/kf2-srv/main.conf.template"
@ -938,20 +1210,25 @@ case $1 in
-u|--update ) if [[ "$EUID" -eq 0 ]]; then update_kf2 ; else run_as_root $*; fi ;;
-v|--validate ) if [[ "$EUID" -eq 0 ]]; then validate ; else run_as_root $*; fi ;;
-r|--run ) shift; run $*; ;;
-c|--chat ) shift; Msg="$1"; shift; chat "$Msg" $*; ;;
-st|--start ) if [[ "$EUID" -eq 0 ]]; then shift; start_instance $*; else run_as_root $*; fi ;;
-sp|--stop ) if [[ "$EUID" -eq 0 ]]; then shift; stop_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 ;;
-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 ;;
-ms|--map-sync ) if [[ "$EUID" -eq 0 ]]; then shift; map_sync ; else run_as_root $*; fi ;;
-ma|--map-add ) if [[ "$EUID" -eq 0 ]]; then shift; map_add $*; else run_as_root $*; fi ;;
-md|--map-del ) if [[ "$EUID" -eq 0 ]]; then shift; map_del $*; else run_as_root $*; fi ;;
-wl|--workshop-list ) if [[ "$EUID" -eq 0 ]]; then shift; workshop_list "-h" ; else run_as_root $*; fi ;;
-wa|--workshop-add ) if [[ "$EUID" -eq 0 ]]; then shift; workshop_add $*; else run_as_root $*; fi ;;
-wd|--workshop-del ) if [[ "$EUID" -eq 0 ]]; then shift; workshop_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 ;;
-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 ;;
-bs|--ban-sync ) if [[ "$EUID" -eq 0 ]]; then shift; ban_sync ; else run_as_root $*; fi ;;
-ba|--ban-add ) if [[ "$EUID" -eq 0 ]]; then shift; ban_add $*; else run_as_root $*; fi ;;
-bd|--ban-del ) if [[ "$EUID" -eq 0 ]]; then shift; ban_del $*; else run_as_root $*; fi ;;
-fp|--fix-permissions ) if [[ "$EUID" -eq 0 ]]; then shift; fix_permissions $*; else run_as_root $*; fi ;;
-as|--admin-sync ) if [[ "$EUID" -eq 0 ]]; then shift; admin_sync ; else run_as_root $*; fi ;;
-pg|--password-game ) if [[ "$EUID" -eq 0 ]]; then shift; Pass="$1"; shift ; password_game "$Pass" $*; else run_as_root $*; fi ;;
-pa|--password-admin ) if [[ "$EUID" -eq 0 ]]; then shift; Pass="$1"; shift ; password_admin "$Pass" $*; else run_as_root $*; fi ;;
* ) echo "Command not recognized: $1"; exit 1 ;;
esac

View File

@ -2,7 +2,7 @@
Description=Check and Update killing Floor 2 beta job
[Timer]
OnCalendar=*-*-* 4:00:00
OnCalendar=Wed, 04:00
Unit=kf2-srv-beta-update.service
[Install]

View File

@ -8,7 +8,7 @@ Type=simple
StandardOutput=null
StandardError=null
EnvironmentFile=/etc/kf2-srv/instances-beta/%i/main.conf
ExecStart=/usr/games/kf2-srv-beta/Binaries/Win64/KFGameSteamServer.bin.x86_64 $Args configsubdir=instances/%i $PortW $PortQ $PortG
ExecStart=/usr/games/kf2-srv-beta/Binaries/Win64/KFGameSteamServer.bin.x86_64 ${Map}?Difficulty=${Difficulty}?GameLength=${Length}?Game=${Game}${Args} configsubdir=instances/%i -webadminport=${PortWeb} -queryport=${PortQuery} -port=${PortGame}
Restart=always
NoNewPrivileges=yes

View File

@ -2,7 +2,7 @@
Description=Check and Update killing Floor 2 job
[Timer]
OnCalendar=*-*-* 4:00:00
OnCalendar=Wed, 04:00
Unit=kf2-srv-update.service
[Install]

20
SOURCES/kf2-srv.conf Normal file → Executable file
View File

@ -1 +1,19 @@
#BranchName="preview"
# Displays game difficulty
# You can rename them as you like
DiffArray=('Normal' 'Hard' 'Suicide' 'Hell')
# Displays the number of waves
# You can rename them as you like
WaveArray=('4' '7' '10')
# Add custom gamemodes to the end of the list, similar to what is already there:
ModeArray['KFGameContent.KFGameInfo_Survival']='Survival'
ModeArray['KFGameContent.KFGameInfo_WeeklySurvival']='Weekly'
ModeArray['KFGameContent.KFGameInfo_Endless']='Endless'
ModeArray['KFGameContent.KFGameInfo_Objective']='Objective'
ModeArray['KFGameContent.KFGameInfo_VersusSurvival']='Versus'
# Bot default password
# To change the password for the bot, you must do this here and in WebAdmin.
# Otherwise, the bot will stop working and some actions cannot be done on running servers
ServerBotPassword=VerySecretBotPassword

View File

@ -8,7 +8,7 @@ Type=simple
StandardOutput=null
StandardError=null
EnvironmentFile=/etc/kf2-srv/instances/%i/main.conf
ExecStart=/usr/games/kf2-srv/Binaries/Win64/KFGameSteamServer.bin.x86_64 $Args configsubdir=instances/%i $PortW $PortQ $PortG
ExecStart=/usr/games/kf2-srv/Binaries/Win64/KFGameSteamServer.bin.x86_64 ${Map}?Difficulty=${Difficulty}?GameLength=${Length}?Game=${Game}${Args} configsubdir=instances/%i -webadminport=${PortWeb} -queryport=${PortQuery} -port=${PortGame}
Restart=always
NoNewPrivileges=yes

View File

@ -1,29 +1,36 @@
LANG=en_US.UTF-8
PortW="-webadminport=8080"
PortQ="-queryport=27015"
PortG="-port=7777"
PortWeb=8080
PortQuery=27015
PortGame=7777
# Default Map
Map=KF-Nuked
# First arg: map name
#
# Difficulty:
# Normal: 0
# Hard: 1
# Suicide: 2
# Hell: 3
#
Difficulty=2
# Game:
# Survival: KFGameContent.KFGameInfo_Survival
# WeeklyOutbreak: KFGameContent.KFGameInfo_WeeklySurvival
# Endless: KFGameContent.KFGameInfo_Endless
# Objective: KFGameContent.KFGameInfo_Objective
# Versus: KFGameContent.KFGameInfo_VersusSurvival
#
Game=KFGameContent.KFGameInfo_Endless
# GameLength:
# 4 waves: 0
# 7 waves: 1
# 10 waves: 2
Args=kf-bioticslab?Difficulty=0?Game=KFGameContent.KFGameInfo_Survival?GameLength=2
Length=2
# Additional parameters
# If the parameter is used, it must necessarily begin with a character '?'
Args=
# Notes for yourself
Description="Default description"
Comment=

View File

@ -1,7 +1,7 @@
%global steamuser steam
Name: kf2-srv
Version: 0.7.0
Version: 0.9.0
Release: 1%{dist}
Summary: Killing Floor 2 server
Group: Amusements/Games
@ -18,6 +18,7 @@ Source7: main.conf.template
Source8: %{name}-beta@.service
Source9: %{name}-beta-update.service
Source10: %{name}-beta-update.timer
Source11: %{name}.conf
Requires: systemd >= 219
Requires: steamcmd
@ -31,6 +32,7 @@ Requires: util-linux
Requires: sudo
Requires: psmisc
Requires: gawk
Requires: multini >= 0.2.3
Provides: %{name}
@ -62,6 +64,7 @@ install -m 644 %{SOURCE7} %{buildroot}/%{_sysconfdir}/%{name}
install -m 644 %{SOURCE8} %{buildroot}/%{_prefix}/lib/systemd/system
install -m 644 %{SOURCE9} %{buildroot}/%{_prefix}/lib/systemd/system
install -m 644 %{SOURCE10} %{buildroot}/%{_prefix}/lib/systemd/system
install -m 644 %{SOURCE11} %{buildroot}/%{_sysconfdir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
@ -72,7 +75,8 @@ rm -rf $RPM_BUILD_ROOT
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/instances
%attr(775,root,%{steamuser}) %dir %{_sysconfdir}/%{name}/instances-beta
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/main.conf.template
%attr(644,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/main.conf.template
%attr(640,root,%{steamuser}) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%attr(644,root,root) %config(noreplace) %{_prefix}/lib/firewalld/services/%{name}.xml
%attr(755,root,root) %{_bindir}/%{name}
%attr(755,root,root) %{_bindir}/%{name}-beta
@ -89,6 +93,20 @@ if [[ $1 -eq 0 ]] ; then # Uninstall
fi
%changelog
* Wed May 27 2020 GenZmeY <genzmey@gmail.com> - 0.9.0-1
- new main.conf format;
- multiple WebAdmin and http auth by default;
- online actions;
- chat-bot;
- set password;
- refactoring.
* 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
- dual versions support;
- check updates;