remove kf2-srv-force-attr

This commit is contained in:
Евгений Юдаков 2020-09-09 14:17:46 +03:00
parent 8f34f6fa95
commit 31167e6f7a
6 changed files with 9 additions and 83 deletions

View File

@ -60,13 +60,11 @@ build:
cp -r $(SOURCEDIR)/main $(RELEASEDIR) cp -r $(SOURCEDIR)/main $(RELEASEDIR)
cp -r $(SOURCEDIR)/config $(RELEASEDIR) cp -r $(SOURCEDIR)/config $(RELEASEDIR)
cp -r $(SOURCEDIR)/force-attr $(RELEASEDIR)
find $(RELEASEDIR) -type f -exec sed -i 's|:DEFINE_PREFIX:|$(PREFIX)|g;' {} \; find $(RELEASEDIR) -type f -exec sed -i 's|:DEFINE_PREFIX:|$(PREFIX)|g;' {} \;
fake-systemd-build: fake-systemd-build:
find $(SOURCEDIR)/main -type f -name '*.service' -exec cp -f {} $(RELEASEDIR)/{} \; 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 's|:DEFINE_PREFIX:|$(DESTDIR)$(PREFIX)|g;' {} \;
find $(RELEASEDIR) -type f -exec sed -i -r 's|ExecStart=.+KFGameSteamServer.bin.x86_64|ExecStart=/bin/bash|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/logrotate/$(NAME) $(LOGROTATEDIR)
install -m 644 $(RELEASEDIR)/main/rsyslog/$(NAME).conf $(RSYSLOGDIR) 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 640 $(RELEASEDIR)/config/bot.conf $(CONFDIR)
install -m 644 $(RELEASEDIR)/config/instance.conf.template $(CONFDIR) install -m 644 $(RELEASEDIR)/config/instance.conf.template $(CONFDIR)
install -m 644 $(RELEASEDIR)/config/$(NAME).conf $(CONFDIR) install -m 644 $(RELEASEDIR)/config/$(NAME).conf $(CONFDIR)
@ -148,9 +143,6 @@ uninstall:
rm -f $(LOGROTATEDIR)/$(NAME) rm -f $(LOGROTATEDIR)/$(NAME)
rm -f $(RSYSLOGDIR)/$(NAME).conf rm -f $(RSYSLOGDIR)/$(NAME).conf
rm -f $(SBINDIR)/$(NAME)-force-attr
rm -f $(UNITDIR)/$(NAME)-force-attr.service
rm -rf $(LICENSEDIR) rm -rf $(LICENSEDIR)
rm -rf $(KF2MAINDIR) rm -rf $(KF2MAINDIR)
rm -rf $(KF2BETADIR) rm -rf $(KF2BETADIR)
@ -165,11 +157,9 @@ test: fake-systemd-build
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-beta-update.timer
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.service $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.service
$(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.timer $(SYSTEMDCHECK) $(RELEASEDIR)/main/systemd/$(NAME)-update.timer
$(SYSTEMDCHECK) $(RELEASEDIR)/force-attr/systemd/$(NAME)-force-attr.service
$(BASHCHECK) $(RELEASEDIR)/main/$(NAME) $(BASHCHECK) $(RELEASEDIR)/main/$(NAME)
$(BASHCHECK) $(RELEASEDIR)/main/$(NAME)-beta $(BASHCHECK) $(RELEASEDIR)/main/$(NAME)-beta
$(BASHCHECK) $(RELEASEDIR)/force-attr/$(NAME)-force-attr
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/ban/list $(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/ban/list
$(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/ban/add $(BASHCHECK) $(RELEASEDIR)/main/cmdgrp/ban/add

View File

@ -25,10 +25,7 @@ MutNames['KFMutator.KFMutator_MaxPlayersV2']='MaxPlayers'
MutNames['ClassicScoreboard.ClassicSCMut']='ClassicSC' MutNames['ClassicScoreboard.ClassicSCMut']='ClassicSC'
MutNames['ZedCustom.ZedCustomMut']='ZedVarients' MutNames['ZedCustom.ZedCustomMut']='ZedVarients'
# These parameters are used when creating new instances. # These parameters are used when creating new instances and in the command "kf2-srv game fix-permissions"
# 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. IniPermissions=664
ForceIniPermissions=664 IniGroup=steam
ForceLogPermissions=644
ForceIniGroup=steam
ForceLogGroup=steam

View File

@ -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 <https://www.gnu.org/licenses/>.
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

View File

@ -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

View File

@ -39,7 +39,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 $ForceIniPermissions {}; chown $SteamUser:$ForceIniGroup {}" sh -c "chmod $IniPermissions {}; chown $SteamUser:$IniGroup {}"
} }
function game_run () # $@: Game args function game_run () # $@: Game args
@ -255,9 +255,9 @@ function make_default_instance () # $1: Dir
local InstanceDir="$InstanceConfigDir/default" local InstanceDir="$InstanceConfigDir/default"
install -d -g "$SteamUser" -o "$ForceIniGroup" -m 775 "$InstanceDir" install -d -g "$SteamUser" -o "$IniGroup" -m 775 "$InstanceDir"
install -d -g "$SteamUser" -o "$ForceIniGroup" -m 775 "$InstanceDir/LinuxServer" install -d -g "$SteamUser" -o "$IniGroup" -m 775 "$InstanceDir/LinuxServer"
install -g "$SteamUser" -o "$ForceIniGroup" -m $ForceIniPermissions "$InstanceConfigTemplate" "$InstanceDir/instance.conf" install -g "$SteamUser" -o "$IniGroup" -m $IniPermissions "$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"

View File

@ -90,8 +90,8 @@ function instance_add () # $*: InstanceName[s]
local InstanceDir="$InstanceConfigDir/$Instance" local InstanceDir="$InstanceConfigDir/$Instance"
local DirMode="-d -g $SteamUser -o $ForceIniGroup -m 775" local DirMode="-d -g $SteamUser -o $IniGroup -m 775"
local FileMode=" -g $SteamUser -o $ForceIniGroup -m $ForceIniPermissions" local FileMode=" -g $SteamUser -o $IniGroup -m $IniPermissions"
install $DirMode "$InstanceDir" install $DirMode "$InstanceDir"
install $DirMode "$InstanceDir/LinuxServer" install $DirMode "$InstanceDir/LinuxServer"