X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=scripts%2Faglsetup.sh;h=3bb6e0cde87b192a05b89cae3b1cf97ab7ee0228;hb=5237004c476955be7fb266c7edf4b526f40eb41c;hp=b11a54196e4d7889936b9c74496d8c90641c8b02;hpb=24c89f22961bab9a995ab9c18881a3109a1c8109;p=AGL%2Fmeta-agl.git diff --git a/scripts/aglsetup.sh b/scripts/aglsetup.sh index b11a54196..3bb6e0cde 100644 --- a/scripts/aglsetup.sh +++ b/scripts/aglsetup.sh @@ -26,7 +26,7 @@ # detect if this script is sourced: see http://stackoverflow.com/a/38128348/6255594 SOURCED=0 -if [ -n "$ZSH_EVAL_CONTEXT" ]; then +if [ -n "$ZSH_EVAL_CONTEXT" ]; then [[ $ZSH_EVAL_CONTEXT =~ :file$ ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $0) && pwd -P); } elif [ -n "$KSH_VERSION" ]; then [[ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- ${.sh.file}) && pwd -P); } @@ -37,9 +37,9 @@ fi if [ $SOURCED -ne 1 ]; then unset SOURCED unset SOURCEDIR - echo "Error: this script needs to be sourced in a supported shell" >&2 - echo "Please check that the current shell is bash, zsh or ksh and run this script as '. $0 '" >&2 - return 1 + echo "Error: this script needs to be sourced in a supported shell" >&2 + echo "Please check that the current shell is bash, zsh or ksh and run this script as '. $0 '" >&2 + exit 56 else unset SOURCED tmpfile=$(mktemp /tmp/aglsetup.XXXXXXXX)