Compare commits

..

1 Commits

Author SHA1 Message Date
f42bee5885 wip 2020-09-20 20:30:32 +03:00
33 changed files with 107 additions and 74 deletions

View File

@ -46,6 +46,7 @@ builddep:
prep: clean-tmp prep: clean-tmp
cd $(SOURCESDIR) && tar czf $(SOURCETARBALL) \ cd $(SOURCESDIR) && tar czf $(SOURCETARBALL) \
config \ config \
force-attr \
main \ main \
COPYING \ COPYING \
Makefile Makefile

54
SOURCES/loggrind/loggrind Normal file
View File

@ -0,0 +1,54 @@
#!/bin/bash
# kf2-srv is a command line tool for managing a set of Killing Floor 2 servers.
# Copyright (C) 2019, 2020 GenZmeY
# mailto: genzmey@gmail.com
#
# This file is part of kf2-srv.
#
# kf2-srv is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
readonly ScriptFullname=$(readlink -e "$0")
readonly ScriptName=$(basename $0)
function show_help ()
{
echo "$ScriptName <service_name> <status_dir>"
}
function grind () # $1: Line
{
}
if [[ $# -ne 2 ]]; then show_help; exit 0; fi
StatusDir=$(readlink -e "$2")
if echo "$1" | grep -P '\.service$'; then
Service="$1"
Name="$1.service"
else
Service="$1.service"
Name="$1"
fi
#if ! [[ -e "$StatusDir/$Name" ]]; then
# READ?
#fi
while read Line
do
grind "$Line"
done < journalctl -f --no-pager -o json --output-fields=MESSAGE -u "$Service" | jq -r '.MESSAGE'

View File

@ -35,8 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "Id can be SteamID3, SteamID64 or a link to a user profile." echo "TODO: description"
echo "EGS players are not supported."
} }
function cmd_main () # $*: ban list function cmd_main () # $*: ban list

View File

@ -35,8 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "Id can be SteamID3, SteamID64 or a link to a user profile." echo "TODO: description"
echo "EGS players are not supported."
} }
function cmd_main () # $*: ban list function cmd_main () # $*: ban list

View File

@ -33,10 +33,10 @@ function cmd_info ()
echo "Show the list of blocked users" echo "Show the list of blocked users"
} }
#function cmd_help () function cmd_help ()
#{ {
# echo "" echo "TODO: description"
#} }
function cmd_main () function cmd_main ()
{ {

View File

@ -33,10 +33,10 @@ function cmd_info ()
echo "Sync blocklist for all servers" echo "Sync blocklist for all servers"
} }
#function cmd_help () function cmd_help ()
#{ {
# echo "" echo "TODO: description"
#} }
function cmd_main () function cmd_main ()
{ {

View File

@ -35,10 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "By default, all files created by the kf2 server" echo "TODO: description"
echo "have 600 permissions, which can be inconvenient."
echo "This command fixes the permissions and groups of"
echo "all ini files to the values specified in kf2-srv.conf"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "Run the server binary directly, without systemd or anything else." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,8 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "Stops all running server instances, installs updates (if any)" echo "TODO: description"
echo "When finished, starts all enabled instances."
} }
function cmd_main () function cmd_main ()

View File

@ -35,8 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "Stops all running server instances, validate server files." echo "TODO: description"
echo "When finished, starts all enabled instances."
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "Name(s) must not contain spaces." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -30,12 +30,12 @@ function cmd_usage ()
function cmd_info () function cmd_info ()
{ {
echo "Send message to specified server instance(s)" echo "Send message to specified server instances"
} }
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, sends a message to all running servers." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -30,12 +30,12 @@ function cmd_usage ()
function cmd_info () function cmd_info ()
{ {
echo "Delete the specified server instance(s)" echo "Delete the specified server instances"
} }
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, deletes all server instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -30,12 +30,12 @@ function cmd_usage ()
function cmd_info () function cmd_info ()
{ {
echo "Disable autostart for specified server instance(s)" echo "Disable specified server instance(s)"
} }
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, disable autostart for all instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -30,12 +30,12 @@ function cmd_usage ()
function cmd_info () function cmd_info ()
{ {
echo "Enable autostart for specified server instance(s)" echo "Enable specified server instance(s)"
} }
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, disable autostart for all instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, displays the status of all instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, restarts all enabled instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, starts all enabled instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, stops all instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, prints the log of all instances." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, prints the log of all instances in real time." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, load map rotation for all instances." echo "TODO: description"
} }
function cmd_main () # $*: Instance[s] function cmd_main () # $*: Instance[s]

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, save map rotation for all instances." echo "TODO: description"
} }
function cmd_main () # $*: Instance[s] function cmd_main () # $*: Instance[s]

View File

@ -35,9 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, set a admin password for all instances." echo "TODO: description"
echo "To remove a password, use an empty password as an argument,"
echo "example: ${ScriptFullname}${KF2POSTFIX} password admin '' test_instance"
} }
function cmd_main () function cmd_main ()

View File

@ -35,9 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "If instance is not specified, set a game password for all instances." echo "TODO: description"
echo "To remove a password, use an empty password as an argument,"
echo "example: ${ScriptFullname}${KF2POSTFIX} password game '' test_instance"
} }
function cmd_main () function cmd_main ()

View File

@ -25,7 +25,7 @@ cmd_need_installed_server () { false ;}
function cmd_usage () function cmd_usage ()
{ {
echo "<workshop_id>..." echo "[<workshop_id>...]"
} }
function cmd_info () function cmd_info ()
@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "workshop_id can be a resource ID or a link to a resource in workshop." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -35,7 +35,7 @@ function cmd_info ()
function cmd_help () function cmd_help ()
{ {
echo "workshop_id can be a resource ID or a link to a resource in workshop." echo "TODO: description"
} }
function cmd_main () function cmd_main ()

View File

@ -33,10 +33,10 @@ function cmd_info ()
echo "Show the list of steam workshop resources" echo "Show the list of steam workshop resources"
} }
#function cmd_help () function cmd_help ()
#{ {
# echo "" echo "TODO: description"
#} }
function cmd_main () function cmd_main ()
{ {

View File

@ -30,13 +30,12 @@ function cmd_usage ()
function cmd_info () function cmd_info ()
{ {
echo "Sync steam workshop resources between all server instances" echo "Sync steamorkshop resources between all server instances"
} }
function cmd_help () function cmd_help ()
{ {
echo "In addition to synchronization, adds loaded maps and mutators to KFGame.ini." echo "TODO: description"
echo "This command works for stopped server instances only."
} }
function cmd_main () function cmd_main ()

View File

@ -197,22 +197,10 @@ elif [[ -d "$GroupPathname" ]]; then
shift shift
source "$CommandPathName" source "$CommandPathName"
if is_help "$1"; then if is_help "$1"; then
if ! function_exists "cmd_usage" \ if function_exists "cmd_help"; then
&& ! function_exists "cmd_info" \ cmd_help
&& ! function_exists "cmd_help"; then
echo "No help page for this command."
else else
if function_exists "cmd_usage"; then echo "No help page for this command."
echo "usage: $(cmd_usage)"
echo
fi
if function_exists "cmd_info"; then
cmd_info
echo
fi
if function_exists "cmd_help"; then
cmd_help
fi
fi fi
elif is_usage "$1"; then elif is_usage "$1"; then
if function_exists "cmd_usage"; then if function_exists "cmd_usage"; then

View File

@ -1,5 +1,6 @@
[Unit] [Unit]
Description=Killing Floor 2 Beta Server Daemon - %i Description=Killing Floor 2 Beta Server Daemon - %i
After=kf2-srv-force-attr.service
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target

View File

@ -1,5 +1,6 @@
[Unit] [Unit]
Description=Killing Floor 2 Server Daemon - %i Description=Killing Floor 2 Server Daemon - %i
After=kf2-srv-force-attr.service
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target

View File

@ -1,7 +1,7 @@
%global steamuser steam %global steamuser steam
Name: kf2-srv Name: kf2-srv
Version: 0.15.9 Version: 0.15.8
Release: 1%{dist} Release: 1%{dist}
Summary: Killing Floor 2 server Summary: Killing Floor 2 server
Group: Amusements/Games Group: Amusements/Games
@ -30,6 +30,7 @@ Requires: gawk
Requires: multini >= 0.2.3 Requires: multini >= 0.2.3
Requires: rsyslog >= 8.25.0 Requires: rsyslog >= 8.25.0
Requires: logrotate Requires: logrotate
Requires: inotify-tools
Requires: bash-completion >= 2.7 Requires: bash-completion >= 2.7
Provides: %{name} Provides: %{name}
@ -73,6 +74,7 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644,root,root) %config(noreplace) %{_prefix}/lib/firewalld/services/%{name}.xml %attr(0644,root,root) %config(noreplace) %{_prefix}/lib/firewalld/services/%{name}.xml
%attr(0755,root,root) %{_bindir}/%{name} %attr(0755,root,root) %{_bindir}/%{name}
%attr(0755,root,root) %{_bindir}/%{name}-beta %attr(0755,root,root) %{_bindir}/%{name}-beta
%attr(0755,root,root) %{_sbindir}/%{name}-force-attr
%attr(0644,root,root) %{_unitdir}/* %attr(0644,root,root) %{_unitdir}/*
%attr(0644,root,root) %doc %{_datadir}/licenses/%{name}/* %attr(0644,root,root) %doc %{_datadir}/licenses/%{name}/*
%attr(0644,root,root) %{_sysconfdir}/rsyslog.d/%{name}.conf %attr(0644,root,root) %{_sysconfdir}/rsyslog.d/%{name}.conf
@ -99,10 +101,8 @@ if [[ $1 == 1 ]]; then # Install
fi fi
%changelog %changelog
* Mon Sep 21 2020 GenZmeY <genzmey@gmail.com> - 0.16.0-1 * Tue Sep 8 2020 GenZmeY <genzmey@gmail.com> - 0.16.0-1
- remove force-attr daemon; - log cmg group.
- log cmg group;
- command descriptions.
* Sat Aug 15 2020 GenZmeY <genzmey@gmail.com> - 0.15.4-1 * Sat Aug 15 2020 GenZmeY <genzmey@gmail.com> - 0.15.4-1
- fixed broken update; - fixed broken update;