From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=96.73.9.1; helo=muon.bluestop.org; envelope-from=rebecca@bluestop.org; receiver=edk2-devel@lists.01.org Received: from muon.bluestop.org (muon.bluestop.org [96.73.9.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4CC86211CCD5A for ; Thu, 21 Feb 2019 21:13:28 -0800 (PST) Received: from muon.bluestop.org (localhost [127.0.0.1]) by muon.bluestop.org (Postfix) with ESMTP id 05FD781C59; Thu, 21 Feb 2019 22:14:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bluestop.org; s=mail; t=1550812462; bh=IcuOyqM1msfOUssd9H28qOMn64g6Tz1ngitfaPFa79Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jexih1lIyQZhLBEyMDkl9MAuwABE8LG0hftjxvgys1k+1MOy8Ayfd4FkI54ne0kiG IERkWYRbNrmwTsxYO5O9dCgEPQr9rjn5yHRJrQ13gLTOtfEBDkBGgxpY9lyuam9ojP 0MH7/BBiu1ppVRuPKslgGz7sh4Ro4Ku0zm4FyIGw= Received: from muon.bluestop.org ([127.0.0.1]) by muon.bluestop.org (muon.bluestop.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xESycw2ZWSXA; Thu, 21 Feb 2019 22:14:20 -0700 (MST) Received: from photon.int.bluestop.org (gw.bluestop.org [96.73.9.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by muon.bluestop.org (Postfix) with ESMTPSA; Thu, 21 Feb 2019 22:14:20 -0700 (MST) From: Rebecca Cran To: edk2-devel@lists.01.org Date: Thu, 21 Feb 2019 22:12:53 -0700 Message-Id: <20190222051253.51931-2-rebecca@bluestop.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222051253.51931-1-rebecca@bluestop.org> References: <20190222051253.51931-1-rebecca@bluestop.org> MIME-Version: 1.0 Subject: [PATCH] Convert PosixLike scripts to sh, reduce duplication and fix some bugs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 05:13:28 -0000 Content-Transfer-Encoding: 8bit Since the scripts in the PosixLike directory are very simple, convert them to use /bin/sh, and move duplicated code into common files (one for python scripts, one for C binaries). Fix some bugs in edksetup.sh and BuildEnv: `test` uses single equals instead of double equals, and should have a space before the ending bracket. Fix some indentation, and if the user runs edksetup.sh with --help etc., quit after displaying the help message. --- BaseTools/BinWrappers/PosixLike/BPDG | 15 ++-------- BaseTools/BinWrappers/PosixLike/Brotli | 30 ++----------------- .../BinWrappers/PosixLike/BrotliCompress | 12 ++++---- BaseTools/BinWrappers/PosixLike/DevicePath | 30 ++----------------- BaseTools/BinWrappers/PosixLike/Ecc | 15 ++-------- BaseTools/BinWrappers/PosixLike/EfiRom | 30 ++----------------- BaseTools/BinWrappers/PosixLike/GenCrc32 | 30 ++----------------- BaseTools/BinWrappers/PosixLike/GenDepex | 15 ++-------- BaseTools/BinWrappers/PosixLike/GenFds | 15 ++-------- BaseTools/BinWrappers/PosixLike/GenFfs | 30 ++----------------- BaseTools/BinWrappers/PosixLike/GenFv | 30 ++----------------- BaseTools/BinWrappers/PosixLike/GenFw | 30 ++----------------- .../BinWrappers/PosixLike/GenPatchPcdTable | 15 ++-------- BaseTools/BinWrappers/PosixLike/GenSec | 30 ++----------------- .../BinWrappers/PosixLike/GenerateCapsule | 15 ++-------- BaseTools/BinWrappers/PosixLike/LzmaCompress | 30 ++----------------- .../BinWrappers/PosixLike/LzmaF86Compress | 2 +- BaseTools/BinWrappers/PosixLike/PatchPcdValue | 15 ++-------- BaseTools/BinWrappers/PosixLike/Pkcs7Sign | 15 ++-------- .../PosixLike/Rsa2048Sha256GenerateKeys | 15 ++-------- .../BinWrappers/PosixLike/Rsa2048Sha256Sign | 15 ++-------- BaseTools/BinWrappers/PosixLike/Split | 30 ++----------------- BaseTools/BinWrappers/PosixLike/TargetTool | 15 ++-------- BaseTools/BinWrappers/PosixLike/TianoCompress | 30 ++----------------- BaseTools/BinWrappers/PosixLike/Trim | 15 ++-------- BaseTools/BinWrappers/PosixLike/UPT | 15 ++-------- BaseTools/BinWrappers/PosixLike/VfrCompile | 30 ++----------------- BaseTools/BinWrappers/PosixLike/VolInfo | 30 ++----------------- BaseTools/BinWrappers/PosixLike/build | 15 ++-------- BaseTools/BinWrappers/PosixLike/common.sh | 12 ++++++++ BaseTools/BinWrappers/PosixLike/commonbin.sh | 28 +++++++++++++++++ BaseTools/BuildEnv | 3 +- edksetup.sh | 12 ++++---- 33 files changed, 110 insertions(+), 559 deletions(-) create mode 100644 BaseTools/BinWrappers/PosixLike/common.sh create mode 100644 BaseTools/BinWrappers/PosixLike/commonbin.sh diff --git a/BaseTools/BinWrappers/PosixLike/BPDG b/BaseTools/BinWrappers/PosixLike/BPDG index c894384908..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/BPDG +++ b/BaseTools/BinWrappers/PosixLike/BPDG @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" -m $cmd.$cmd "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Brotli b/BaseTools/BinWrappers/PosixLike/Brotli index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/Brotli +++ b/BaseTools/BinWrappers/PosixLike/Brotli @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/BrotliCompress b/BaseTools/BinWrappers/PosixLike/BrotliCompress index ea86705a28..7cb26a3659 100755 --- a/BaseTools/BinWrappers/PosixLike/BrotliCompress +++ b/BaseTools/BinWrappers/PosixLike/BrotliCompress @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # This script will exec Brotli tool with -e/-d options. # @@ -20,21 +20,21 @@ do -e) ;; -d) - ARGS+="$1 " + ARGS="$ARGS $1" ;; -o|-g) - ARGS+="$1 $2 " + ARGS="$ARGS $1 $2" shift ;; -q) - QLT="$1 $2 " + QLT="$1 $2" shift ;; *) - ARGS+="$1 " + ARGS="$ARGS $1" ;; esac shift done -exec Brotli $QLT $ARGS +exec "$(dirname "$0")/Brotli" $QLT $ARGS diff --git a/BaseTools/BinWrappers/PosixLike/DevicePath b/BaseTools/BinWrappers/PosixLike/DevicePath index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/DevicePath +++ b/BaseTools/BinWrappers/PosixLike/DevicePath @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/PosixLike/Ecc index 15edf52106..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/Ecc +++ b/BaseTools/BinWrappers/PosixLike/Ecc @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" -m $cmd.EccMain "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/EfiRom b/BaseTools/BinWrappers/PosixLike/EfiRom index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/EfiRom +++ b/BaseTools/BinWrappers/PosixLike/EfiRom @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenCrc32 b/BaseTools/BinWrappers/PosixLike/GenCrc32 index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/GenCrc32 +++ b/BaseTools/BinWrappers/PosixLike/GenCrc32 @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenDepex b/BaseTools/BinWrappers/PosixLike/GenDepex index 183cf58224..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/GenDepex +++ b/BaseTools/BinWrappers/PosixLike/GenDepex @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/AutoGen/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenFds b/BaseTools/BinWrappers/PosixLike/GenFds index c894384908..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/GenFds +++ b/BaseTools/BinWrappers/PosixLike/GenFds @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" -m $cmd.$cmd "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenFfs b/BaseTools/BinWrappers/PosixLike/GenFfs index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/GenFfs +++ b/BaseTools/BinWrappers/PosixLike/GenFfs @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenFv b/BaseTools/BinWrappers/PosixLike/GenFv index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/GenFv +++ b/BaseTools/BinWrappers/PosixLike/GenFv @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenFw b/BaseTools/BinWrappers/PosixLike/GenFw index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/GenFw +++ b/BaseTools/BinWrappers/PosixLike/GenFw @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable b/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable index f3770eed42..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable +++ b/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenSec b/BaseTools/BinWrappers/PosixLike/GenSec index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/GenSec +++ b/BaseTools/BinWrappers/PosixLike/GenSec @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenerateCapsule b/BaseTools/BinWrappers/PosixLike/GenerateCapsule index 023048c61d..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/GenerateCapsule +++ b/BaseTools/BinWrappers/PosixLike/GenerateCapsule @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/Capsule/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/LzmaCompress b/BaseTools/BinWrappers/PosixLike/LzmaCompress index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/LzmaCompress +++ b/BaseTools/BinWrappers/PosixLike/LzmaCompress @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/LzmaF86Compress b/BaseTools/BinWrappers/PosixLike/LzmaF86Compress index 078cb1e21d..4049f9f596 100755 --- a/BaseTools/BinWrappers/PosixLike/LzmaF86Compress +++ b/BaseTools/BinWrappers/PosixLike/LzmaF86Compress @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # This script will exec LzmaCompress tool with --f86 option that enables converter for x86 code. # diff --git a/BaseTools/BinWrappers/PosixLike/PatchPcdValue b/BaseTools/BinWrappers/PosixLike/PatchPcdValue index f3770eed42..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/PatchPcdValue +++ b/BaseTools/BinWrappers/PosixLike/PatchPcdValue @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign b/BaseTools/BinWrappers/PosixLike/Pkcs7Sign index f3770eed42..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/Pkcs7Sign +++ b/BaseTools/BinWrappers/PosixLike/Pkcs7Sign @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys index ea71c7c61a..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/Rsa2048Sha256Sign/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign index f3770eed42..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign +++ b/BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Split b/BaseTools/BinWrappers/PosixLike/Split index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/Split +++ b/BaseTools/BinWrappers/PosixLike/Split @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/TargetTool b/BaseTools/BinWrappers/PosixLike/TargetTool index f3770eed42..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/TargetTool +++ b/BaseTools/BinWrappers/PosixLike/TargetTool @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/TianoCompress b/BaseTools/BinWrappers/PosixLike/TianoCompress index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/TianoCompress +++ b/BaseTools/BinWrappers/PosixLike/TianoCompress @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Trim b/BaseTools/BinWrappers/PosixLike/Trim index 1dd28e9662..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/Trim +++ b/BaseTools/BinWrappers/PosixLike/Trim @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -exe=$(basename "$full_cmd") - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/UPT b/BaseTools/BinWrappers/PosixLike/UPT index f3770eed42..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/UPT +++ b/BaseTools/BinWrappers/PosixLike/UPT @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/VfrCompile b/BaseTools/BinWrappers/PosixLike/VfrCompile index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/VfrCompile +++ b/BaseTools/BinWrappers/PosixLike/VfrCompile @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/VolInfo b/BaseTools/BinWrappers/PosixLike/VolInfo index 0945d86d92..3dfa26e517 100755 --- a/BaseTools/BinWrappers/PosixLike/VolInfo +++ b/BaseTools/BinWrappers/PosixLike/VolInfo @@ -1,29 +1,3 @@ -#!/usr/bin/env bash - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -then - exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" -elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] -then - if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] - then - echo "BaseTools C Tool binary was not found ($cmd)" - echo "You may need to run:" - echo " make -C $EDK_TOOLS_PATH/Source/C" - else - exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" - fi -elif [ -e "$dir/../../Source/C/bin/$cmd" ] -then - exec "$dir/../../Source/C/bin/$cmd" "$@" -else - echo "Unable to find the real '$cmd' to run" - echo "This message was printed by" - echo " $0" - exit 127 -fi +#!/bin/sh +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/build b/BaseTools/BinWrappers/PosixLike/build index f3770eed42..a9da3afb4b 100755 --- a/BaseTools/BinWrappers/PosixLike/build +++ b/BaseTools/BinWrappers/PosixLike/build @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -#python `dirname $0`/RunToolFromSource.py `basename $0` $* +#!/bin/sh -# If a ${PYTHON_COMMAND} command is available, use it in preference to python -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=${PYTHON_COMMAND} -fi - -full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here -dir=$(dirname "$full_cmd") -cmd=${full_cmd##*/} - -export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" +. "$(dirname "$(realpath "$0")")/common.sh" diff --git a/BaseTools/BinWrappers/PosixLike/common.sh b/BaseTools/BinWrappers/PosixLike/common.sh new file mode 100644 index 0000000000..63a45bb54c --- /dev/null +++ b/BaseTools/BinWrappers/PosixLike/common.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# If a ${PYTHON_COMMAND} command is available, use it in preference to python +if command -v "${PYTHON_COMMAND}" >/dev/null 2>&1; then + python_exe=${PYTHON_COMMAND} +fi + +dir="$(dirname "$(realpath "$0")")" +cmd=${0##*/} + +export PYTHONPATH="${dir}/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" +exec "${python_exe:-python}" "${dir}/../../Source/Python/$cmd/${cmd}.py" "$@" diff --git a/BaseTools/BinWrappers/PosixLike/commonbin.sh b/BaseTools/BinWrappers/PosixLike/commonbin.sh new file mode 100644 index 0000000000..948def9ce7 --- /dev/null +++ b/BaseTools/BinWrappers/PosixLike/commonbin.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +dir="$(dirname "$(realpath "$0")")" +cmd=${0##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BuildEnv b/BaseTools/BuildEnv index ff0c5115a5..b321828471 100755 --- a/BaseTools/BuildEnv +++ b/BaseTools/BuildEnv @@ -1,3 +1,4 @@ +#!/usr/bin/env bash ## @file # Setup the environment for unix-like systems running a bash-like shell. # This file must be "sourced" not merely executed. For example: ". edksetup.sh" @@ -136,7 +137,7 @@ SetEdkToolsPath() { # # Try $PACKAGES_PATH # - if [ -n "$PACKAGES_PATH"] + if [ -n "$PACKAGES_PATH" ] then PATH_LIST=${PACKAGES_PATH//:/ } for DIR in $PATH_LIST diff --git a/edksetup.sh b/edksetup.sh index a8897d10f8..4457be6e96 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # # Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
# Copyright (c) 2016, Linaro Ltd. All rights reserved.
@@ -115,8 +116,8 @@ function SetupPython3() { if [ $origin_version ];then origin_version= - fi - for python in $(whereis python3) + fi + for python in $(whereis python3) do python=$(echo $python | grep "[[:digit:]]$" || true) python_version=${python##*python} @@ -133,8 +134,8 @@ function SetupPython3() origin_version=$python_version export PYTHON_COMMAND=$python fi - done - return 0 + done + return 0 } function SetupPython() @@ -148,7 +149,7 @@ function SetupPython() fi fi - if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE == TRUE ] + if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE = TRUE ] then SetupPython3 fi @@ -204,6 +205,7 @@ do ;; -?|-h|--help|*) HelpMsg + return 0 break ;; esac -- 2.20.1