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/common-functions | 2 +- lib/intentions-queue | 6 +++--- lib/load-configuration | 2 +- lib/mysql-functions | 13 +++++++------ 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/common-functions b/lib/common-functions index 4af92db..8c263ab 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -2,7 +2,7 @@ # contains functions used by more than one script -# shellcheck disable=SC2039,SC2119,SC2120 +# shellcheck disable=SC2039,SC2119,SC2120,SC3043 if [ -z "${base_dir}" ]; then # just to make shellcheck happy diff --git a/lib/intentions-queue b/lib/intentions-queue index c0d88a8..802d1ca 100755 --- a/lib/intentions-queue +++ b/lib/intentions-queue @@ -2,7 +2,7 @@ # contains functions related to the intentions-queue -# shellcheck disable=SC2039 +# shellcheck disable=SC2039,SC3043 if [ -z "${base_dir}" ]; then # just to make shellcheck happy @@ -15,7 +15,7 @@ fi # $package_database_lock_file externally intent_something() { local next_number - if [ "x$1" = 'x-n' ]; then + if [ "$1" = '-n' ]; then cat return fi @@ -75,7 +75,7 @@ execute_intention() { # with -n: return immediately # without -n: wait until nothing more to do intentions_left() { - if [ ! "x$1" = 'x-n' ]; then + if [ ! "$1" = '-n' ]; then while intentions_left -n; do sleep 1 done diff --git a/lib/load-configuration b/lib/load-configuration index 6b2d7ff..4c825f1 100755 --- a/lib/load-configuration +++ b/lib/load-configuration @@ -38,7 +38,7 @@ else fi # dirty hack to get this stuff debugable from a bash -if [ "x${0##*/}" = "x-bash" ] || [ "x${0##*/}" = "xbash" ] || [ "x${0##*/}" = "xdash" ]; then +if [ "${0##*/}" = "-bash" ] || [ "${0##*/}" = "bash" ] || [ "${0##*/}" = "dash" ]; then set +e if [ -z "${base_dir}" ]; then base_dir=$(pwd) 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