From 6f59df0faa06e9e5b2127d8376b12bb1cf2db5fd Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 5 Jun 2021 20:26:21 +0200 Subject: make shellcheck happy again --- lib/mysql-functions | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/mysql-functions') diff --git a/lib/mysql-functions b/lib/mysql-functions index 6a6a1e7..af2c3ba 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -2,7 +2,7 @@ # contains functions used to access mysql db -# shellcheck disable=SC2016,SC2039,SC2119,SC2120 +# shellcheck disable=SC2016,SC2039,SC2119,SC2120,SC3043 if [ -z "${base_dir}" ]; then # just to make shellcheck happy @@ -35,7 +35,7 @@ mysql_run_query() { local number file_name_extra='' - if [ "x$1" = 'xunimportant' ]; then + if [ "$1" = 'unimportant' ]; then shift file_name_extra='unimportant_' elif [ -s "${work_dir}/build-master-sanity" ]; then @@ -47,7 +47,7 @@ mysql_run_query() { query_stdout="${query_stdin%.stdin}.stdout" query_stderr="${query_stdin%.stdin}.stderr" cat > "${query_stdin}" - for _ in {1..10}; do + for _ in $(seq 10); do if [ -f "${query_stdout}" ]; then wait_some_time 10 10 fi @@ -221,7 +221,8 @@ mysql_generate_package_metadata() { mod_git_revision="$4" repository="$5" - if [[ "${current_repository_id}" = *[!0-9]* ]]; then + if printf '%s\n' "${current_repository_id}" \ + | grep -q '[^0-9]'; then >&2 printf 'mysql_generate_package_metadata(): invalid current_repository_id="%s".\n' \ "${current_repository_id}" exit 2 @@ -898,7 +899,7 @@ mysql_cleanup() { local operator if [ "$#" = '0' ]; then operator='DELETE' - elif [ "$#" = '1' ] && [ "x$1" = 'xdry' ]; then + elif [ "$#" = '1' ] && [ "$1" = 'dry' ]; then operator='SELECT COUNT(1)' else >&2 echo 'Unknown parameter' @@ -1558,7 +1559,7 @@ mysql_sort_versions() { ( # new shell is intentional tmp_file=$(mktemp 'tmp.mysql_sort_versions.XXXXXXXXXX' --tmpdir) trap 'rm "${tmp_file}"' EXIT - if [ "x$1" != 'x-f' ] && \ + if [ "$1" != '-f' ] && \ { printf 'SELECT' printf ' COUNT(1)' -- cgit v1.2.3-54-g00ecf