X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=edksetup.sh;h=0b7e33fd77769eefa62b30278003ef54830b31ca;hp=cc4f58211afe4a9eec3fd132243a0414d13889b5;hb=e1f2dfec3483e276d267f5ca3540c1505d631c60;hpb=2b1473c1ba8138de830c53a3e9bbaab5ad3a472e diff --git a/edksetup.sh b/edksetup.sh index cc4f58211a..0b7e33fd77 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -1,6 +1,6 @@ # -# Copyright (c) 2006 - 2008, Intel Corporation -# All rights reserved. This program and the accompanying materials +# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -25,25 +25,51 @@ # Please reference edk2 user manual for more detail descriptions at https://edk2.tianocore.org/files/documents/64/494/EDKII_UserManual.pdf # -if [ \ - -z "$1" -o \ - "$1" = "-?" -o \ - "$1" = "-h" -o \ - "$1" = "--help" \ - ] -then - echo BaseTools Usage: \'. edksetup.sh\' - echo +function HelpMsg() +{ echo Please note: This script must be \'sourced\' so the environment can be changed. - echo \(Either \'. edksetup.sh\' or \'source edksetup.sh\'\) - return + echo ". edksetup.sh" + echo "source edksetup.sh" + return 1 +} + +function SetupEnv() +{ + if [ -z "$WORKSPACE" ] + then + . BaseTools/BuildEnv $* + else + . $WORKSPACE/BaseTools/BuildEnv $* + fi +} + +function SourceEnv() +{ + if [ \ + "$1" = "-?" -o \ + "$1" = "-h" -o \ + "$1" = "--help" \ + ] + then + HelpMsg + else + SetupEnv "$*" + fi +} + +if [ $# -gt 1 ] +then + HelpMsg +elif [ $# -eq 1 ] && [ "$1" != "BaseTools" ] +then + HelpMsg fi -if [ -z "$WORKSPACE" ] +RETVAL=$? +if [ $RETVAL -ne 0 ] then - . BaseTools/BuildEnv $* -else - . $WORKSPACE/BaseTools/BuildEnv $* + return $RETVAL fi +SourceEnv "$*"