Skip to content

Commit 57d74ae

Browse files
authored
Merge pull request #1441 from roycaihw/detect-os-x-sed
Detect OS X sed and fail client generation script
2 parents 0ea3542 + 684544e commit 57d74ae

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

scripts/update-client.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ set -o pipefail
2424
# The openapi-generator version used by this client
2525
export OPENAPI_GENERATOR_COMMIT="v4.3.0"
2626

27+
# OS X sed doesn't support "--version". This way we can tell if OS X sed is
28+
# used.
29+
if ! sed --version &>/dev/null; then
30+
# OS X sed and GNU sed aren't compatible with backup flag "-i". Namely
31+
# sed -i ... - does not work on OS X
32+
# sed -i'' ... - does not work on certain OS X versions
33+
# sed -i '' ... - does not work on GNU
34+
echo ">>> OS X sed detected, which may be incompatible with this script. Please install and use GNU sed instead:
35+
$ brew install gnu-sed
36+
$ brew info gnu-sed
37+
# Find the path to the installed gnu-sed and add it to your PATH. The default
38+
# is:
39+
# PATH=\"/Users/\$USER/homebrew/opt/gnu-sed/libexec/gnubin:\$PATH\""
40+
exit 1
41+
fi
42+
2743
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")
2844
CLIENT_ROOT="${SCRIPT_ROOT}/../kubernetes"
2945
CLIENT_VERSION=$(python "${SCRIPT_ROOT}/constants.py" CLIENT_VERSION)

0 commit comments

Comments
 (0)