This commit is contained in:
2020-08-08 03:40:13 +03:00
parent fd2b147ab6
commit f942c10f81
6 changed files with 34 additions and 61 deletions

View File

@ -26,6 +26,31 @@ readonly ScriptVersion=$(rpm -q --queryformat '%{VERSION}' "$ScriptName")
readonly GrpDir=":DEFINE_PREFIX:/share/kf2-srv/cmdgrp"
readonly LibDir=":DEFINE_PREFIX:/share/kf2-srv/lib"
readonly InstallDir=":DEFINE_PREFIX:/games/kf2-srv${KF2POSTFIX}"
readonly AppBin="$InstallDir/Binaries/Win64/KFGameSteamServer.bin.x86_64"
readonly DefaultConfigDir="$InstallDir/KFGame/Config"
readonly DefaultDownloadDir="$InstallDir/Binaries/Win64/steamapps/workshop"
readonly DefaultCacheDir="$InstallDir/KFGame/Cache"
readonly DefaultLogDir="$InstallDir/KFGame/Logs"
readonly DownloadDir="/var/cache/kf2-srv/workshop"
readonly CacheDir="/var/cache/kf2-srv/cache"
readonly LogDir="/var/log/kf2-srv${KF2POSTFIX}"
readonly InstanceConfigDir="/etc/kf2-srv/instances${KF2POSTFIX}"
readonly InstanceConfigTemplate="/etc/kf2-srv/instance.conf.template"
readonly AppServerNum="232130"
readonly AppClientNum="232090"
readonly StrangeConstUID="17825793"
readonly ServerBotLogin="srvbot"
declare -a DiffNames
declare -a WaveNames
declare -A ModeNames
declare -A MutNames
function include () # $1: Lib
{
if ! echo "$INC_LIBS" | grep -Foq "$1"; then
@ -40,7 +65,8 @@ function run_as_steamuser () # $@: command
if [[ "$(whoami)" == "$SteamUser" ]]; then
shift 2; cmd_main "$@"
elif [[ -n $(groups "$(whoami)" | grep -Fo 'wheel') ]] || [[ "$EUID" -eq 0 ]]; then
elif [[ -n $(groups "$(whoami)" | grep -Fo 'wheel') ]] || [[ "$(whoami)" == "root" ]]; then
export INC_LIBS=""
sudo -u "$SteamUser" "$@"
else
echo "You must be a $SteamUser, root or sudo-user to run this command."
@ -52,6 +78,7 @@ function run_as_root () # $@: command
if [[ "$(whoami)" == "root" ]]; then
shift 2; cmd_main "$@"
elif [[ -n $(groups "$(whoami)" | grep -Fo 'wheel') ]]; then
export INC_LIBS=""
sudo "$@"
else
echo "You must be root or sudo-user to run this command."