From: Stephen Rothwell Date: Wed, 30 Nov 2022 05:17:47 +0000 (+1100) Subject: common.sh: use "normal" conditionals X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=a274ddaaa7d35d399871a8f48fa84a9d93eeb7ff;p=next-scripts common.sh: use "normal" conditionals --- diff --git a/common.sh b/common.sh index 3dfda68..947c1c2 100644 --- a/common.sh +++ b/common.sh @@ -3,13 +3,17 @@ # # Just in case this gets included twice ... -[ "$_next_common_included" ] && return 0 +if [ "$_next_common_included" ]; then + return 0 +fi _next_common_included=1 bin_dir=$(realpath "$(dirname "$0")") top_dir=$(dirname "$bin_dir") -[ "$LOG_FILE" ] || LOG_FILE="$top_dir/merge.log" +if [ -z "$LOG_FILE" ]; then + LOG_FILE="$top_dir/merge.log" +fi SHA1_FILE="$top_dir/SHA1s" CTRL_FILE="$top_dir/etc/control" @@ -20,26 +24,38 @@ j_factor=$(nproc) gpg_key=89F91C0A41D5C07A kup_gpg_key=015042F34957D06C -[ "$NEXT_BUILD_HOST" ] && { +if [ "$NEXT_BUILD_HOST" ]; then build_host="$NEXT_BUILD_HOST" - [ "$build_host" = "none" ] && build_host="" -} -[ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR" -[ "$NEXT_GCC_VERSION" ] && gcc_version="$NEXT_GCC_VERSION" + if [ "$build_host" = "none" ]; then + build_host="" + fi +fi +if [ "$NEXT_BUILD_DIR" ]; then + build_dir="$NEXT_BUILD_DIR" +fi +if [ "$NEXT_GCC_VERSION" ]; then + gcc_version="$NEXT_GCC_VERSION" +fi gcc_ppc_version=$gcc_version -[ "$NEXT_GCC_PPC_VERSION" ] && gcc_ppc_version="$NEXT_GCC_PPC_VERSION" +if [ "$NEXT_GCC_PPC_VERSION" ]; then + gcc_ppc_version="$NEXT_GCC_PPC_VERSION" +fi gcc_ppcle_version=$gcc_ppc_version -[ "$NEXT_GCC_PPCLE_VERSION" ] && gcc_ppcle_version="$NEXT_GCC_PPCLE_VERSION" -[ "$NEXT_J_FACTOR" ] && j_factor="$NEXT_J_FACTOR" +if [ "$NEXT_GCC_PPCLE_VERSION" ]; then + gcc_ppcle_version="$NEXT_GCC_PPCLE_VERSION" +fi +if [ "$NEXT_J_FACTOR" ]; then + j_factor="$NEXT_J_FACTOR" +fi -[ -n "$1" ] && { +if [ -n "$1" ]; then build_host="$1" shift -} -[ -n "$1" ] && { +fi +if [ -n "$1" ]; then build_dir="$1" shift -} +fi export NEXT_BUILD_HOST="${build_host:-none}" export NEXT_BUILD_DIR="$build_dir"