diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2020-01-17 19:35:31 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2020-01-21 15:28:09 +0300 |
commit | 512028d952ee109e8c09591979c46945bae83f31 (patch) | |
tree | b67adc13f5faef4b15a273ef1d0939fe53379e90 /setup | |
parent | 5e3ca9366bf6d88308d6740fe77a1cdc0204eff9 (diff) | |
download | openbmc-512028d952ee109e8c09591979c46945bae83f31.tar.xz |
setup: support zsh
zsh populates $0 even when sourcing a script. This caused sourcing
this script to think that it was being executed and it `exit 1`d
the running shell. Since no sane distribution would ever set /bin/sh
to zsh, the presence of $ZSH_NAME implies that the script is being
sourced.
Tested with both bash and zsh in both modes of operation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2843d96a7fdaa46f9ee6edb9031ca9c16ca3bd98
Diffstat (limited to 'setup')
-rwxr-xr-x | setup | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -15,8 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -if [ "$(basename -- "$0")" = "setup" ]; then +if [ -z "$ZSH_NAME" ] && [ "$(basename -- "$0")" = "setup" ]; then echo The script must be sourced, not executed exit 1 fi |