MT#60865 Fix shellcheck script issues

As reported at https://jenkins.mgm.sipwise.com/job/ngcpcfg-tap-test/4544/
when building against Debian/trixie

Furthermore fix SC2166 + SC2086 issues within helper/check-for-mysql
as reported by manual shellcheck v0.10.0 runs.

Change-Id: Ic9be0dbc8ef4a501cf3b6e62522574da72f85c99
mr13.0
Michael Prokop 8 months ago
parent 125ab4c0a2
commit eb1cd98403

@ -8,7 +8,7 @@ else
CONF="/etc/mysql/my.cnf"
fi
if [ $COUNT -le 0 ] ; then
if [ "$COUNT" -le 0 ] ; then
echo "Usage: $0 <number_of_seconds> [<mysqlid>]" >&2
exit 1
fi
@ -45,8 +45,8 @@ mysqld_status () {
ps_alive=1
fi
if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
[ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then
if { [ "$1" = "check_alive" ] && [ "$ping_alive" = 1 ]; } ||
{ [ "$1" = "check_dead" ] && [ "$ping_alive" = 0 ] && [ "$ps_alive" = 0 ]; }; then
return 0
fi
@ -54,7 +54,7 @@ mysqld_status () {
}
printf "Checking MySQL service status (for a maximum of %s seconds): " "$COUNT"
for _ in $(seq 1 $COUNT) ; do
for _ in $(seq 1 "$COUNT") ; do
if mysqld_status check_alive warn; then
printf "available.\n"
exit 0

@ -193,6 +193,7 @@ find_instance() {
local target
# get rid of "./" and "//"
# shellcheck disable=SC2001
service_file=$(echo "$1" | sed -e 's_\./_/_g ; s_//_/_g')
for instance in "${INSTANCES[@]}"; do
@ -228,7 +229,9 @@ find_changed_instance_services() {
local target_file
# get rid of "./" and "//"
# shellcheck disable=SC2001
file=$(echo "$1"| sed -e 's_\./_/_g ; s_//_/_g')
# shellcheck disable=SC2001
dir=$(echo "$2"| sed -e 's_\./_/_g ; s_//_/_g')
for instance in "${INSTANCES[@]}"; do

@ -1,3 +1,3 @@
#!/bin/sh
echo "INSTANCE_NAME:${INSTANCE_NAME:-}" > \
${OUTPUT_DIRECTORY:-/tmp}/ngcpcfg.service${INSTANCE_NAME:-}
"${OUTPUT_DIRECTORY:-/tmp}/ngcpcfg.service${INSTANCE_NAME:-}"

@ -1,3 +1,3 @@
#!/bin/sh
echo "INSTANCE_NAME:${INSTANCE_NAME:-}" > \
${OUTPUT_DIRECTORY:-/tmp}/ngcpcfg.service${INSTANCE_NAME:-}
"${OUTPUT_DIRECTORY:-/tmp}/ngcpcfg.service${INSTANCE_NAME:-}"

Loading…
Cancel
Save