Skip to content

Commit 38c9545

Browse files
author
OpenShift Bot
authored
Merge pull request #11535 from stevekuznetsov/skuznets/migrate-utilities
Merged by openshift-bot
2 parents 5dc2155 + 7168fe6 commit 38c9545

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

hack/lib/util/misc.sh

+36
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,39 @@ function os::util::find-go-binary() {
129129
done
130130
}
131131
readonly -f os::util::find-go-binary
132+
133+
# os::util::sed attempts to make our Bash scripts agnostic to the platform
134+
# on which they run `sed` by glossing over a discrepancy in flag use in GNU.
135+
#
136+
# Globals:
137+
# None
138+
# Arguments:
139+
# - all: arguments to pass to `sed -i`
140+
# Return:
141+
# None
142+
function os::util::sed() {
143+
if LANG=C sed --help 2>&1 | grep -q "GNU sed"; then
144+
sed -i'' "$@"
145+
else
146+
sed -i '' "$@"
147+
fi
148+
}
149+
readonly -f os::util::sed
150+
151+
# os::util::base64decode attempts to make our Bash scripts agnostic to the platform
152+
# on which they run `base64decode` by glossing over a discrepancy in flag use in GNU.
153+
#
154+
# Globals:
155+
# None
156+
# Arguments:
157+
# - all: arguments to pass to `base64decode`
158+
# Return:
159+
# None
160+
function os::util::base64decode() {
161+
if [[ "$(go env GOHOSTOS)" == "darwin" ]]; then
162+
base64 -D "$@"
163+
else
164+
base64 -d "$@"
165+
fi
166+
}
167+
readonly -f os::util::base64decode

hack/util.sh

+1-19
Original file line numberDiff line numberDiff line change
@@ -543,22 +543,4 @@ readonly -f find_files
543543
function os::util::host_platform() {
544544
echo "$(go env GOHOSTOS)/$(go env GOHOSTARCH)"
545545
}
546-
readonly -f os::util::host_platform
547-
548-
function os::util::sed() {
549-
if LANG=C sed --help 2>&1 | grep -qs "GNU sed"; then
550-
sed -i'' "$@"
551-
else
552-
sed -i '' "$@"
553-
fi
554-
}
555-
readonly -f os::util::sed
556-
557-
function os::util::base64decode() {
558-
if [[ "$(go env GOHOSTOS)" == "darwin" ]]; then
559-
base64 -D $@
560-
else
561-
base64 -d $@
562-
fi
563-
}
564-
readonly -f os::util::base64decode
546+
readonly -f os::util::host_platform

0 commit comments

Comments
 (0)