Interpret backslash escapes for RCON_CMDS (#3008)

This commit is contained in:
Miika Kankare 2024-07-21 18:29:41 +03:00 committed by GitHub
parent d7c6a7d2b6
commit b393b22136
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,7 +44,7 @@ do
if [[ "$RCON_CMDS_STARTUP" ]]; then if [[ "$RCON_CMDS_STARTUP" ]]; then
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$RCON_CMDS_STARTUP" done <<< "$(echo -e "$RCON_CMDS_STARTUP")"
fi fi
if if
[[ -z "$RCON_CMDS_ON_CONNECT" ]] && [[ -z "$RCON_CMDS_ON_CONNECT" ]] &&
@ -66,7 +66,7 @@ do
logRcon "First Clients has Connected, running first connect cmds" logRcon "First Clients has Connected, running first connect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$RCON_CMDS_FIRST_CONNECT" done <<< "$(echo -e "$RCON_CMDS_FIRST_CONNECT")"
fi fi
# When a client joins # When a client joins
@ -74,13 +74,13 @@ do
logRcon "Clients have Connected, running connect cmds" logRcon "Clients have Connected, running connect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$RCON_CMDS_ON_CONNECT" done <<< "$(echo -e "$RCON_CMDS_ON_CONNECT")"
# When a client leaves # When a client leaves
elif (( CURR_CLIENTCONNECTIONS < CLIENTCONNECTIONS )) && [[ "$RCON_CMDS_ON_DISCONNECT" ]]; then elif (( CURR_CLIENTCONNECTIONS < CLIENTCONNECTIONS )) && [[ "$RCON_CMDS_ON_DISCONNECT" ]]; then
logRcon "Clients have Disconnected, running disconnect cmds" logRcon "Clients have Disconnected, running disconnect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$RCON_CMDS_ON_DISCONNECT" done <<< "$(echo -e "$RCON_CMDS_ON_DISCONNECT")"
fi fi
# Last client connection # Last client connection
@ -89,7 +89,7 @@ do
logRcon "ALL Clients have Disconnected, running last disconnect cmds" logRcon "ALL Clients have Disconnected, running last disconnect cmds"
while read -r cmd; do while read -r cmd; do
run_command "$cmd" run_command "$cmd"
done <<< "$RCON_CMDS_LAST_DISCONNECT" done <<< "$(echo -e "$RCON_CMDS_LAST_DISCONNECT")"
fi fi
CLIENTCONNECTIONS=$CURR_CLIENTCONNECTIONS CLIENTCONNECTIONS=$CURR_CLIENTCONNECTIONS
;; ;;