X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=edksetup.sh;h=0b7e33fd77769eefa62b30278003ef54830b31ca;hp=c4fe9a60eff70a97a7b36d8b868cfa15224ece29;hb=62c058ca9f28bb58f301fb0edae53a007350a5ef;hpb=24542fb2118e3921502c70996a30a8fe7cbc2d29 diff --git a/edksetup.sh b/edksetup.sh index c4fe9a60ef..0b7e33fd77 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+# 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 @@ -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 "$*"