From 2cebdbd585d498c4d9e0169563ce1381dc017005 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 30 Sep 2023 22:02:28 +0100 Subject: [PATCH] refactor: update shard name in server.ini The code has been refactored to update the shard name in the server.ini file. This change ensures that the shard name in the LinuxGSM config matches the one in server.ini. --- lgsm/modules/fix_dst.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lgsm/modules/fix_dst.sh b/lgsm/modules/fix_dst.sh index addd786f3f..a364357737 100644 --- a/lgsm/modules/fix_dst.sh +++ b/lgsm/modules/fix_dst.sh @@ -17,12 +17,12 @@ if [ -f "/etc/redhat-release" ] && [ ! -f "${serverfiles}/bin/lib32/libcurl-gnut fi # Keeps shard name in server.ini the same as in the LinuxGSM config. -if [ -f "${serverfiles}/server.ini" ]; then - if [ "$(grep -Ec '^name[[:space:]]*=' "${serverfiles}/server.ini")" -eq 1 ]; then - if [ "$(grep -E '^name[[:space:]]*=' "${serverfiles}/server.ini" | cut -d '=' -f2 | tr -d '"' | tr -d ' ')" != "${shard}" ]; then +if [ -f "${servercfgfullpath}" ]; then + if [ "$(grep -Ec '^name[[:space:]]*=' "${servercfgfullpath}")" -eq 1 ]; then + if [ "$(grep -E '^name[[:space:]]*=' "${servercfgfullpath}" | cut -d '=' -f2 | tr -d '"' | tr -d ' ')" != "${shard}" ]; then fixname="update server.ini shard name" fn_fix_msg_start - sed -i -e "s/name[[:space:]]*=.*/name = \"${shard}\"/g" "${serverfiles}/server.ini" + sed -i -e "s/name[[:space:]]*=.*/name = \"${shard}\"/g" "${servercfgfullpath}" fn_fix_msg_end fi fi