Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #72 from jkroepke/patch-1
Browse files Browse the repository at this point in the history
Add auto detection for gnu-getops
  • Loading branch information
szibis committed Mar 29, 2019
2 parents a593633 + d0f6d33 commit 1c195b4
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,30 @@ HELM_BIN="${HELM_BIN:-helm}"
getopt --test > /dev/null
if [[ $? -ne 4 ]]
then
cat <<EOF
# Check if gnu-getopt is installed
if [ -x /usr/local/opt/gnu-getopt/bin/getopt ]
then
/usr/local/opt/gnu-getopt/bin/getopt --test > /dev/null
if [[ $? -ne 4 ]]
then
GNU_GETOPT=0
else
GNU_GETOPT=1
export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
fi
else
GNU_GETOPT=0
fi

if [ "${GNU_GETOPT}" -ne 1 ]; then
cat <<EOF
I’m sorry, "getopt --test" failed in this environment.
You may need to install enhanced getopt, e.g. on OSX using
"brew install gnu-getopt".
EOF
exit 1
exit 1
fi
fi

set -ueo pipefail
Expand Down

0 comments on commit 1c195b4

Please sign in to comment.