From 31167e6f7ad3a117e020524392701184eac22023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=AE=D0=B4?= =?UTF-8?q?=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Wed, 9 Sep 2020 14:17:46 +0300 Subject: [PATCH] remove kf2-srv-force-attr --- SOURCES/Makefile | 10 ----- SOURCES/config/kf2-srv.conf | 9 ++-- SOURCES/force-attr/kf2-srv-force-attr | 43 ------------------- .../systemd/kf2-srv-force-attr.service | 18 -------- SOURCES/main/lib/game.lib | 8 ++-- SOURCES/main/lib/instance.lib | 4 +- 6 files changed, 9 insertions(+), 83 deletions(-) delete mode 100644 SOURCES/force-attr/kf2-srv-force-attr delete mode 100644 SOURCES/force-attr/systemd/kf2-srv-force-attr.service diff --git a/SOURCES/Makefile b/SOURCES/Makefile index 1549fa0..b1686b7 100644 --- a/SOURCES/Makefile +++ b/SOURCES/Makefile @@ -60,13 +60,11 @@ build: cp -r $(SOURCEDIR)/main $(RELEASEDIR) cp -r $(SOURCEDIR)/config $(RELEASEDIR) - cp -r $(SOURCEDIR)/force-attr $(RELEASEDIR) find $(RELEASEDIR) -type f -exec sed -i 's|:DEFINE_PREFIX:|$(PREFIX)|g;' {} \; fake-systemd-build: find $(SOURCEDIR)/main -type f -name '*.service' -exec cp -f {} $(RELEASEDIR)/{} \; - find $(SOURCEDIR)/force-attr -type f -name '*.service' -exec cp -f {} $(RELEASEDIR)/{} \; find $(RELEASEDIR) -type f -exec sed -i 's|:DEFINE_PREFIX:|$(DESTDIR)$(PREFIX)|g;' {} \; find $(RELEASEDIR) -type f -exec sed -i -r 's|ExecStart=.+KFGameSteamServer.bin.x86_64|ExecStart=/bin/bash|g;' {} \; @@ -122,9 +120,6 @@ install: filesystem build install -m 644 $(RELEASEDIR)/main/logrotate/$(NAME) $(LOGROTATEDIR) install -m 644 $(RELEASEDIR)/main/rsyslog/$(NAME).conf $(RSYSLOGDIR) - install -m 755 $(RELEASEDIR)/force-attr/$(NAME)-force-attr $(SBINDIR) - install -m 644 $(RELEASEDIR)/force-attr/systemd/$(NAME)-force-attr.service $(UNITDIR) - install -m 640 $(RELEASEDIR)/config/bot.conf $(CONFDIR) install -m 644 $(RELEASEDIR)/config/instance.conf.template $(CONFDIR) install -m 644 $(RELEASEDIR)/config/$(NAME).conf $(CONFDIR) @@ -148,9 +143,6 @@ uninstall: rm -f $(LOGROTATEDIR)/$(NAME) rm -f $(RSYSLOGDIR)/$(NAME).conf - rm -f $(SBINDIR)/$(NAME)-force-attr - rm -f $(UNITDIR)/$(NAME)-force-attr.service - rm -rf $(LICENSEDIR) rm -rf $(KF2MAINDIR) rm -rf $(KF2BETADIR) @@ -165,11 +157,9 @@ test: fake-systemd-build $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.service $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.timer - $(SYSTEMDCHECK) $(RELEASEDIR)/force-attr/systemd/$(NAME)-force-attr.service $(BASHCHECK) $(RELEASEDIR)/main/$(NAME) $(BASHCHECK) $(RELEASEDIR)/main/$(NAME)-beta - $(BASHCHECK) $(RELEASEDIR)/force-attr/$(NAME)-force-attr $(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/ban/list $(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/ban/add diff --git a/SOURCES/config/kf2-srv.conf b/SOURCES/config/kf2-srv.conf index dcbb93f..a8b793e 100644 --- a/SOURCES/config/kf2-srv.conf +++ b/SOURCES/config/kf2-srv.conf @@ -25,10 +25,7 @@ MutNames['KFMutator.KFMutator_MaxPlayersV2']='MaxPlayers' MutNames['ClassicScoreboard.ClassicSCMut']='ClassicSC' MutNames['ZedCustom.ZedCustomMut']='ZedVarients' -# 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 -ForceLogPermissions=644 -ForceIniGroup=steam -ForceLogGroup=steam +# These parameters are used when creating new instances and in the command "kf2-srv game fix-permissions" +IniPermissions=664 +IniGroup=steam diff --git a/SOURCES/force-attr/kf2-srv-force-attr b/SOURCES/force-attr/kf2-srv-force-attr deleted file mode 100644 index 02a5a58..0000000 --- a/SOURCES/force-attr/kf2-srv-force-attr +++ /dev/null @@ -1,43 +0,0 @@ -#!/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 . - -declare -A ModeNames MutNames - -source "/etc/kf2-srv/kf2-srv.conf" - -DirLog="/var/log/kf2-srv" -DirLogBeta="/var/log/kf2-srv-beta" -DirInstances="/etc/kf2-srv/instances" -DirInstancesBeta="/etc/kf2-srv/instances-beta" - -/usr/bin/inotifywait -qmr -e create -e moved_to --format %w%f \ -"$DirLog" "$DirLogBeta" "$DirInstances" "$DirInstancesBeta" | \ -while read File -do - if echo "$File" | grep -Piq "\.log$"; then - chmod "$ForceLogPermissions" "$File" - chown :"$ForceLogGroup" "$File" - elif echo "$File" | grep -Piq "\.ini$"; then - chmod "$ForceIniPermissions" "$File" - chown :"$ForceIniGroup" "$File" - fi -done - diff --git a/SOURCES/force-attr/systemd/kf2-srv-force-attr.service b/SOURCES/force-attr/systemd/kf2-srv-force-attr.service deleted file mode 100644 index f61ae46..0000000 --- a/SOURCES/force-attr/systemd/kf2-srv-force-attr.service +++ /dev/null @@ -1,18 +0,0 @@ -[Unit] -Description=kf2-srv force attr service - -[Service] -Type=simple -StandardOutput=null -StandardError=null -ExecStart=:DEFINE_PREFIX:/sbin/kf2-srv-force-attr -Restart=always - -NoNewPrivileges=yes -PrivateTmp=true -PrivateDevices=true -ProtectHome=true -ProtectSystem=true - -[Install] -WantedBy=multi-user.target diff --git a/SOURCES/main/lib/game.lib b/SOURCES/main/lib/game.lib index 68fd5bd..859b9a9 100644 --- a/SOURCES/main/lib/game.lib +++ b/SOURCES/main/lib/game.lib @@ -39,7 +39,7 @@ function fix_ini_permissions () # $1: Dir find "$1" \( -type l -o -type f \) -name '*.ini' | \ xargs --max-procs=$(nproc) -I {} \ - sh -c "chmod $ForceIniPermissions {}; chown $SteamUser:$ForceIniGroup {}" + sh -c "chmod $IniPermissions {}; chown $SteamUser:$IniGroup {}" } function game_run () # $@: Game args @@ -255,9 +255,9 @@ function make_default_instance () # $1: Dir local InstanceDir="$InstanceConfigDir/default" - install -d -g "$SteamUser" -o "$ForceIniGroup" -m 775 "$InstanceDir" - install -d -g "$SteamUser" -o "$ForceIniGroup" -m 775 "$InstanceDir/LinuxServer" - install -g "$SteamUser" -o "$ForceIniGroup" -m $ForceIniPermissions "$InstanceConfigTemplate" "$InstanceDir/instance.conf" + install -d -g "$SteamUser" -o "$IniGroup" -m 775 "$InstanceDir" + install -d -g "$SteamUser" -o "$IniGroup" -m 775 "$InstanceDir/LinuxServer" + install -g "$SteamUser" -o "$IniGroup" -m $IniPermissions "$InstanceConfigTemplate" "$InstanceDir/instance.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" diff --git a/SOURCES/main/lib/instance.lib b/SOURCES/main/lib/instance.lib index 92467c3..9f0d947 100644 --- a/SOURCES/main/lib/instance.lib +++ b/SOURCES/main/lib/instance.lib @@ -90,8 +90,8 @@ function instance_add () # $*: InstanceName[s] local InstanceDir="$InstanceConfigDir/$Instance" - local DirMode="-d -g $SteamUser -o $ForceIniGroup -m 775" - local FileMode=" -g $SteamUser -o $ForceIniGroup -m $ForceIniPermissions" + local DirMode="-d -g $SteamUser -o $IniGroup -m 775" + local FileMode=" -g $SteamUser -o $IniGroup -m $IniPermissions" install $DirMode "$InstanceDir" install $DirMode "$InstanceDir/LinuxServer"