From d32544d05602c7147ea7f7659141b3ee1de934f5 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 27 Nov 2024 14:16:37 +1100 Subject: [PATCH] rpm-install: galera detection with fault tolerance There was no need for subshell, and to make shellcheck happy do the glob to arrays. --- scripts/rpm-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/rpm-install.sh b/scripts/rpm-install.sh index 3f47e100..c6207659 100755 --- a/scripts/rpm-install.sh +++ b/scripts/rpm-install.sh @@ -57,7 +57,12 @@ else fi -sh -c 'g=/usr/lib*/galera*/libgalera_smm.so; echo -e "[galera]\nwsrep_provider=$g"' | +galera=(/usr/lib*/galera*/libgalera_smm.so) +if [ ${#galera[@]} -ne 1 ]; then + bb_log_error "Expected exactly one file, found ${#galera[@]}" + exit 1 +fi +echo -e "[galera]\nwsrep_provider=${galera[0]}" | sudo tee /etc/my.cnf.d/galera.cnf # Any of the below steps could fail