diff --git a/helper/check-for-mysql b/helper/check-for-mysql index c2a1970e..5500c082 100755 --- a/helper/check-for-mysql +++ b/helper/check-for-mysql @@ -8,7 +8,7 @@ else CONF="/etc/mysql/my.cnf" fi -if [ $COUNT -le 0 ] ; then +if [ "$COUNT" -le 0 ] ; then echo "Usage: $0 []" >&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 diff --git a/scripts/services b/scripts/services index 38faf6e3..042b2e58 100755 --- a/scripts/services +++ b/scripts/services @@ -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 diff --git a/t/fixtures/apply_instances/etc/kamailio/lb/ngcpcfg.services b/t/fixtures/apply_instances/etc/kamailio/lb/ngcpcfg.services index 99a2369a..7fd44e49 100755 --- a/t/fixtures/apply_instances/etc/kamailio/lb/ngcpcfg.services +++ b/t/fixtures/apply_instances/etc/kamailio/lb/ngcpcfg.services @@ -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:-}" diff --git a/t/fixtures/build_instances/etc/kamailio/lb/ngcpcfg.services b/t/fixtures/build_instances/etc/kamailio/lb/ngcpcfg.services index 99a2369a..7fd44e49 100755 --- a/t/fixtures/build_instances/etc/kamailio/lb/ngcpcfg.services +++ b/t/fixtures/build_instances/etc/kamailio/lb/ngcpcfg.services @@ -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:-}"