From 7b0ea99a3ecfa725113c8fa6e471d9d796112bdf Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Sun, 23 Jun 2019 12:07:25 -0700 Subject: [PATCH 1/2] copy kube::release:md5 to kube::util::md5 --- hack/lib/util.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 7ea579e41bb..5719485ab4e 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -702,6 +702,15 @@ function kube::util::require-jq { fi } +# outputs md5 hash of $1, works on macOS and Linux +function kube::util::md5() { + if which md5 >/dev/null 2>&1; then + md5 -q "$1" + else + md5sum "$1" | awk '{ print $1 }' + fi +} + # kube::util::read-array # Reads in stdin and adds it line by line to the array provided. This can be # used instead of "mapfile -t", and is bash 3 compatible. From c8a6a720c386c5d4f895e0cf64531f24bf614f6b Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Sun, 23 Jun 2019 12:00:39 -0700 Subject: [PATCH 2/2] use kube::util::md5 for update-vendor-licenses.sh --- hack/update-vendor-licenses.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/update-vendor-licenses.sh b/hack/update-vendor-licenses.sh index 21d7d2f42cf..d9f7d3e0d6b 100755 --- a/hack/update-vendor-licenses.sh +++ b/hack/update-vendor-licenses.sh @@ -162,7 +162,7 @@ echo "= Kubernetes licensed under: =" echo cat "${LICENSE_ROOT}/LICENSE" echo -echo "= LICENSE $(md5sum < "${LICENSE_ROOT}/LICENSE" | awk '{print $1}')" +echo "= LICENSE $(kube::util::md5 "${LICENSE_ROOT}/LICENSE")" echo "================================================================================" ) > ${TMP_LICENSE_FILE} @@ -211,7 +211,7 @@ __EOF__ cat "${file}" echo - echo "= ${file} $(md5sum < "${file}" | awk '{print $1}')" + echo "= ${file} $(kube::util::md5 "${file}")" echo "================================================================================" echo done >> ${TMP_LICENSE_FILE}