From a746959fc1bcedef64a9600468d8e15a8857b144 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 30 Aug 2020 12:57:19 +0200 Subject: [PATCH 1/3] hack: fix SC2069 : to redirect stdout+stderr, 2>&1 must be last See https://github.com/koalaman/shellcheck/wiki/SC2069 Signed-off-by: Sebastiaan van Stijn --- hack/test | 2 +- hack/util | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/test b/hack/test index 447acd05..2445ef8b 100755 --- a/hack/test +++ b/hack/test @@ -35,7 +35,7 @@ case $buildmode in esac cacheVolume="buildx-cache" -if ! docker inspect "$cacheVolume" 2>&1 >/dev/null ; then +if ! docker inspect "$cacheVolume" > /dev/null 2>&1 ; then cacheVolume=$(docker create --name=buildx-cache -v /root/.cache -v /go/pkg/mod alpine) fi diff --git a/hack/util b/hack/util index a9ceca35..9627d33b 100755 --- a/hack/util +++ b/hack/util @@ -25,7 +25,7 @@ if [ -z "$CLI_PLATFORM" ]; then rawos=$(uname -s) if [ "$rawos" = "Darwin" ]; then CLI_PLATFORM="darwin/amd64" - elif uname -s | grep MINGW 2>&1 >/dev/null ; then + elif uname -s | grep MINGW > /dev/null 2>&1 ; then CLI_PLATFORM="windows/amd64" fi fi From aa8ab9fcca6ef09c71fbe93dde483e50cc260f1c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 30 Aug 2020 12:59:03 +0200 Subject: [PATCH 2/3] hack/util: fix mixed tab/spaces for indentation Signed-off-by: Sebastiaan van Stijn --- hack/util | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hack/util b/hack/util index 9627d33b..1d99c4b9 100755 --- a/hack/util +++ b/hack/util @@ -22,11 +22,11 @@ else fi if [ -z "$CLI_PLATFORM" ]; then - rawos=$(uname -s) - if [ "$rawos" = "Darwin" ]; then - CLI_PLATFORM="darwin/amd64" - elif uname -s | grep MINGW > /dev/null 2>&1 ; then - CLI_PLATFORM="windows/amd64" - fi + rawos=$(uname -s) + if [ "$rawos" = "Darwin" ]; then + CLI_PLATFORM="darwin/amd64" + elif uname -s | grep MINGW > /dev/null 2>&1 ; then + CLI_PLATFORM="windows/amd64" + fi fi From 20f8f67928a58fc2dc35e2ab725ccd92e8fb3c4e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 31 Aug 2020 11:40:10 +0200 Subject: [PATCH 3/3] hack/util: take other arches into account on Darwin Signed-off-by: Sebastiaan van Stijn --- hack/util | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hack/util b/hack/util index 1d99c4b9..17e76d26 100755 --- a/hack/util +++ b/hack/util @@ -22,9 +22,12 @@ else fi if [ -z "$CLI_PLATFORM" ]; then - rawos=$(uname -s) - if [ "$rawos" = "Darwin" ]; then - CLI_PLATFORM="darwin/amd64" + if [ "$(uname -s)" = "Darwin" ]; then + arch="$(uname -m)" + if [ "$arch" = "x86_64" ]; then + arch="amd64" + fi + CLI_PLATFORM="darwin/$arch" elif uname -s | grep MINGW > /dev/null 2>&1 ; then CLI_PLATFORM="windows/amd64" fi