From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 E1B4C211CFBE3 for ; Mon, 25 Feb 2019 19:11:14 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 19:11:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,413,1544515200"; d="scan'208";a="137199244" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 25 Feb 2019 19:11:13 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 25 Feb 2019 19:11:13 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 25 Feb 2019 19:11:12 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.232]) with mapi id 14.03.0415.000; Tue, 26 Feb 2019 11:11:08 +0800 From: "Feng, Bob C" To: Rebecca Cran , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] Convert PosixLike scripts to sh, reduce duplication and fix some bugs Thread-Index: AQHUym1dYDwZ5CiN1k2ALtwK5SGtX6Xxa8Zw Date: Tue, 26 Feb 2019 03:11:07 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16008F224@SHSMSX101.ccr.corp.intel.com> References: <20190222051253.51931-1-rebecca@bluestop.org> <20190222051253.51931-2-rebecca@bluestop.org> In-Reply-To: <20190222051253.51931-2-rebecca@bluestop.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Tue, 26 Feb 2019 03:11:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Rebecca, I like the change of moving duplicated code into common files and the bug f= ix looks good. I tested this patch on our CI system, it break the build on MacOS. There is= no realpath command on MacOs shell. For the patch itself, it need to pass the check of BaseTools/Scripts/PatchC= heck.py. Is there actual problem that need to be resolved by using sh instead of bas= h? Thanks, Bob -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Rebe= cca Cran via edk2-devel Sent: Friday, February 22, 2019 1:13 PM To: edk2-devel@lists.01.org Subject: [edk2] [PATCH] Convert PosixLike scripts to sh, reduce duplication= and fix some bugs 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 instea= d 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 a= fter 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/P= osixLike/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/BrotliCompress b/BaseTools/Bin= Wrappers/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+=3D"$1 " + ARGS=3D"$ARGS $1" ;; -o|-g) - ARGS+=3D"$1 $2 " + ARGS=3D"$ARGS $1 $2" shift ;; -q) - QLT=3D"$1 $2 " + QLT=3D"$1 $2" shift ;; *) - ARGS+=3D"$1 " + ARGS=3D"$ARGS $1" ;; esac shift done =20 -exec Brotli $QLT $ARGS +exec "$(dirname "$0")/Brotli" $QLT $ARGS diff --git a/BaseTools/BinWrappers/PosixLike/DevicePath b/BaseTools/BinWrap= pers/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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/Po= sixLike/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenCrc32 b/BaseTools/BinWrappe= rs/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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenDepex b/BaseTools/BinWrappe= rs/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenPatchPcdTable b/BaseTools/B= inWrappers/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/GenerateCapsule b/BaseTools/Bi= nWrappers/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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/BinWr= appers/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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/LzmaF86Compress b/BaseTools/Bi= nWrappers/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 c= onverter for x86 code. # diff --git a/BaseTools/BinWrappers/PosixLike/PatchPcdValue b/BaseTools/BinW= rappers/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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/BinWrapp= ers/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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/Ba= seTools/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/TargetTool b/BaseTools/BinWrap= pers/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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/BinW= rappers/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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/Trim b/BaseTools/BinWrappers/P= osixLike/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -exe=3D$(basename "$full_cmd") - -export PYTHONPATH=3D"$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/Po= sixLike/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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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/BinWrap= pers/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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(dirname "$(realpath "$0")")/commonbin.sh" diff --git a/BaseTools/BinWrappers/PosixLike/VolInfo b/BaseTools/BinWrapper= s/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=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] -the= n - 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 =20 +. "$(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 =20 -# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon -if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then - python_exe=3D${PYTHON_COMMAND} -fi - -full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here -dir=3D$(dirname "$fu= ll_cmd") -cmd=3D${full_cmd##*/} - -export PYTHONPATH=3D"$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/BinWrapp= ers/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=20 +python if command -v "${PYTHON_COMMAND}" >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +dir=3D"$(dirname "$(realpath "$0")")" +cmd=3D${0##*/} + +export PYTHONPATH=3D"${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/BinWr= appers/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=3D"$(dirname "$(realpath "$0")")" +cmd=3D${0##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]=20 +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..b321= 828471 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: ". edksetu= p.sh" @@ -136,7 +137,7 @@ SetEdkToolsPath() { # # Try $PACKAGES_PATH # - if [ -n "$PACKAGES_PATH"] + if [ -n "$PACKAGES_PATH" ] then PATH_LIST=3D${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=3D - fi - for python in $(whereis python3) + fi + for python in $(whereis python3) do python=3D$(echo $python | grep "[[:digit:]]$" || true) python_version=3D${python##*python} @@ -133,8 +134,8 @@ function Set= upPython3() origin_version=3D$python_version export PYTHON_COMMAND=3D$python fi - done - return 0 + done + return 0 } =20 function SetupPython() @@ -148,7 +149,7 @@ function SetupPython() fi fi =20 - if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE =3D=3D TRUE ] + if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE =3D TRUE ] then SetupPython3 fi @@ -204,6 +205,7 @@ do ;; -?|-h|--help|*) HelpMsg + return 0 break ;; esac -- 2.20.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel