summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2020-01-17 19:35:31 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2020-01-21 15:28:09 +0300
commit512028d952ee109e8c09591979c46945bae83f31 (patch)
treeb67adc13f5faef4b15a273ef1d0939fe53379e90 /setup
parent5e3ca9366bf6d88308d6740fe77a1cdc0204eff9 (diff)
downloadopenbmc-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-xsetup3
1 files changed, 1 insertions, 2 deletions
diff --git a/setup b/setup
index d018c9814..a1702f991 100755
--- a/setup
+++ b/setup
@@ -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