From b944b0b011f7c208f3ee85f6c7c7ec2613750353 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Tue, 5 Mar 2019 19:13:16 -0800 Subject: [PATCH] Fix build on platforms with bash not under /bin/ Not every platform has bash under /bin. For example, nixos keeps all binaries under /nix/store and sets PATH accordingly to point to all of them. In this environment, the right way to access bash is using /usr/bin/env to locate shell. (The only shell guaranteed to exist at a particular path on posix systems is /bin/sh.) /usr/bin/env is always present on all systems so swapping direct call to /bin/sh with `/usr/bin/env bash` should work everywhere. --- cluster/build.sh | 2 +- cluster/clean.sh | 2 +- cluster/cli.sh | 2 +- cluster/deploy.sh | 2 +- cluster/down.sh | 2 +- cluster/ephemeral-provider-common.sh | 2 +- cluster/external/provider.sh | 2 +- cluster/k8s-1.10.11/provider.sh | 2 +- cluster/k8s-1.11.0/provider.sh | 2 +- cluster/k8s-genie-1.11.1/provider.sh | 2 +- cluster/k8s-multus-1.13.3/provider.sh | 2 +- cluster/kubectl.sh | 2 +- cluster/local/provider.sh | 2 +- cluster/os-3.11.0-crio/provider.sh | 2 +- cluster/os-3.11.0-multus/provider.sh | 2 +- cluster/os-3.11.0/provider.sh | 2 +- cluster/up.sh | 2 +- cluster/virtctl.sh | 2 +- hack/bazel-generate.sh | 2 +- hack/bootstrap-ginkgo.sh | 2 +- hack/build-copy-artifacts.sh | 2 +- hack/build-docker.sh | 2 +- hack/build-func-tests-container.sh | 2 +- hack/build-func-tests.sh | 2 +- hack/build-go.sh | 2 +- hack/build-manifests.sh | 2 +- hack/builder/build.sh | 2 +- hack/builder/entrypoint.sh | 2 +- hack/builder/publish.sh | 2 +- hack/check.sh | 2 +- hack/common.sh | 2 +- hack/coverage.sh | 2 +- hack/dep-prune.sh | 2 +- hack/dockerized | 2 +- hack/functests.sh | 2 +- hack/gen-swagger-doc/gen-swagger-docs.sh | 2 +- hack/generate.sh | 2 +- hack/goveralls.sh | 2 +- hack/verify-build.sh | 2 +- hack/version.sh | 2 +- 40 files changed, 40 insertions(+), 40 deletions(-) diff --git a/cluster/build.sh b/cluster/build.sh index 607a8e8987f1..e94254fee74b 100755 --- a/cluster/build.sh +++ b/cluster/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/cluster/clean.sh b/cluster/clean.sh index 61ff3721b22d..c74ae6e2a3c7 100755 --- a/cluster/clean.sh +++ b/cluster/clean.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/cluster/cli.sh b/cluster/cli.sh index 82c4f6e0122c..d327d194e8e8 100755 --- a/cluster/cli.sh +++ b/cluster/cli.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e source hack/common.sh diff --git a/cluster/deploy.sh b/cluster/deploy.sh index 8e4be1b77a84..29d4985dda2d 100755 --- a/cluster/deploy.sh +++ b/cluster/deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/cluster/down.sh b/cluster/down.sh index 0ab1acb826b2..d6223497320c 100755 --- a/cluster/down.sh +++ b/cluster/down.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source hack/common.sh source cluster/$KUBEVIRT_PROVIDER/provider.sh diff --git a/cluster/ephemeral-provider-common.sh b/cluster/ephemeral-provider-common.sh index 3814eb509bb2..937ff878db2f 100644 --- a/cluster/ephemeral-provider-common.sh +++ b/cluster/ephemeral-provider-common.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/external/provider.sh b/cluster/external/provider.sh index 25bd835ba915..095161822a6e 100644 --- a/cluster/external/provider.sh +++ b/cluster/external/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash function _kubectl() { kubectl "$@" diff --git a/cluster/k8s-1.10.11/provider.sh b/cluster/k8s-1.10.11/provider.sh index 53e3001401e5..6fd81d56b2a4 100644 --- a/cluster/k8s-1.10.11/provider.sh +++ b/cluster/k8s-1.10.11/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/k8s-1.11.0/provider.sh b/cluster/k8s-1.11.0/provider.sh index f47d86633db3..a2260fabfa59 100644 --- a/cluster/k8s-1.11.0/provider.sh +++ b/cluster/k8s-1.11.0/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/k8s-genie-1.11.1/provider.sh b/cluster/k8s-genie-1.11.1/provider.sh index 074c20558986..eb6a9f4e33e0 100644 --- a/cluster/k8s-genie-1.11.1/provider.sh +++ b/cluster/k8s-genie-1.11.1/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/k8s-multus-1.13.3/provider.sh b/cluster/k8s-multus-1.13.3/provider.sh index f7768545830e..2939225205db 100644 --- a/cluster/k8s-multus-1.13.3/provider.sh +++ b/cluster/k8s-multus-1.13.3/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/kubectl.sh b/cluster/kubectl.sh index 83ab2c196574..3b09832d9c0f 100755 --- a/cluster/kubectl.sh +++ b/cluster/kubectl.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/cluster/local/provider.sh b/cluster/local/provider.sh index 30b6118a0230..586ff27c7d55 100644 --- a/cluster/local/provider.sh +++ b/cluster/local/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash function _cert_dir() { echo $GOPATH/src/kubevirt.io/kubevirt/cluster/local/certs diff --git a/cluster/os-3.11.0-crio/provider.sh b/cluster/os-3.11.0-crio/provider.sh index a7876ea6f362..83da25df0247 100755 --- a/cluster/os-3.11.0-crio/provider.sh +++ b/cluster/os-3.11.0-crio/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/os-3.11.0-multus/provider.sh b/cluster/os-3.11.0-multus/provider.sh index 9aefd5efd51c..bfc344bf0183 100644 --- a/cluster/os-3.11.0-multus/provider.sh +++ b/cluster/os-3.11.0-multus/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/os-3.11.0/provider.sh b/cluster/os-3.11.0/provider.sh index 971fe3754fa6..81d342ad9db4 100644 --- a/cluster/os-3.11.0/provider.sh +++ b/cluster/os-3.11.0/provider.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/cluster/up.sh b/cluster/up.sh index 8993daf0edf9..21d391c5b91b 100755 --- a/cluster/up.sh +++ b/cluster/up.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash source hack/common.sh source cluster/$KUBEVIRT_PROVIDER/provider.sh diff --git a/cluster/virtctl.sh b/cluster/virtctl.sh index 3fc83b252cde..659015d1d06b 100755 --- a/cluster/virtctl.sh +++ b/cluster/virtctl.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/bazel-generate.sh b/hack/bazel-generate.sh index 7bfe1980ee9d..620bfb5807df 100755 --- a/hack/bazel-generate.sh +++ b/hack/bazel-generate.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # remove libvirt BUILD file to regenerate it each time rm -f vendor/github.com/libvirt/libvirt-go/BUILD.bazel diff --git a/hack/bootstrap-ginkgo.sh b/hack/bootstrap-ginkgo.sh index 7493b996d2e6..f67668952d99 100755 --- a/hack/bootstrap-ginkgo.sh +++ b/hack/bootstrap-ginkgo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/hack/build-copy-artifacts.sh b/hack/build-copy-artifacts.sh index 11de865ad06d..fe6d57a4b727 100755 --- a/hack/build-copy-artifacts.sh +++ b/hack/build-copy-artifacts.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/build-docker.sh b/hack/build-docker.sh index 124888c00789..85610fe6c691 100755 --- a/hack/build-docker.sh +++ b/hack/build-docker.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/build-func-tests-container.sh b/hack/build-func-tests-container.sh index 81b97fb6bc06..8af7ce71d497 100755 --- a/hack/build-func-tests-container.sh +++ b/hack/build-func-tests-container.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/build-func-tests.sh b/hack/build-func-tests.sh index 569c5cf41c94..0cb59f7d4446 100755 --- a/hack/build-func-tests.sh +++ b/hack/build-func-tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/build-go.sh b/hack/build-go.sh index 6141b5b93cbf..a5e2367794e0 100755 --- a/hack/build-go.sh +++ b/hack/build-go.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/build-manifests.sh b/hack/build-manifests.sh index dc3e1537a65b..3d2650a3f4b7 100755 --- a/hack/build-manifests.sh +++ b/hack/build-manifests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/builder/build.sh b/hack/builder/build.sh index cb7135f5a231..ac541f356df9 100755 --- a/hack/builder/build.sh +++ b/hack/builder/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash SCRIPT_DIR="$( cd "$(dirname "$BASH_SOURCE[0]")" diff --git a/hack/builder/entrypoint.sh b/hack/builder/entrypoint.sh index 00e6ce2692b3..07800afac874 100755 --- a/hack/builder/entrypoint.sh +++ b/hack/builder/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e set -o pipefail diff --git a/hack/builder/publish.sh b/hack/builder/publish.sh index ce45c764a124..d91e1f20b153 100755 --- a/hack/builder/publish.sh +++ b/hack/builder/publish.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash docker tag kubevirt/builder:28-5.0.0 docker.io/kubevirt/builder:28-5.0.0 docker push docker.io/kubevirt/builder:28-5.0.0 diff --git a/hack/check.sh b/hack/check.sh index 2532ca59eecc..4ac290d3b6d6 100755 --- a/hack/check.sh +++ b/hack/check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e source hack/common.sh diff --git a/hack/common.sh b/hack/common.sh index ffffe1e75c97..ab7580d3ec7f 100644 --- a/hack/common.sh +++ b/hack/common.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash KUBEVIRT_DIR="$( cd "$(dirname "$BASH_SOURCE[0]")/../" diff --git a/hack/coverage.sh b/hack/coverage.sh index ae52ac7469c4..54e78e88b4b4 100755 --- a/hack/coverage.sh +++ b/hack/coverage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/hack/dep-prune.sh b/hack/dep-prune.sh index 227c2354baf3..45469ab57fc4 100755 --- a/hack/dep-prune.sh +++ b/hack/dep-prune.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash for file in $(find vendor/ -name "*_test.go"); do rm ${file}; done rm -rf vendor/github.com/golang/glog mkdir -p vendor/github.com/golang/ diff --git a/hack/dockerized b/hack/dockerized index 22e6ae9a23a2..772974771f57 100755 --- a/hack/dockerized +++ b/hack/dockerized @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e source $(dirname "$0")/common.sh diff --git a/hack/functests.sh b/hack/functests.sh index bf08236a6abc..9d3f673ff843 100755 --- a/hack/functests.sh +++ b/hack/functests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the KubeVirt project # diff --git a/hack/gen-swagger-doc/gen-swagger-docs.sh b/hack/gen-swagger-doc/gen-swagger-docs.sh index 4ddd268e8409..a7cb037dbde0 100755 --- a/hack/gen-swagger-doc/gen-swagger-docs.sh +++ b/hack/gen-swagger-doc/gen-swagger-docs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # gen-swagger-docs.sh $API_VERSION $OUTPUT_FORMAT # API_VERSION=v1 diff --git a/hack/generate.sh b/hack/generate.sh index 6fe3ce8773a8..ac5225155545 100755 --- a/hack/generate.sh +++ b/hack/generate.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/hack/goveralls.sh b/hack/goveralls.sh index 6e95f54d1c6c..402b90322bc1 100755 --- a/hack/goveralls.sh +++ b/hack/goveralls.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/hack/verify-build.sh b/hack/verify-build.sh index 17c586efe119..8e5e89ae1394 100755 --- a/hack/verify-build.sh +++ b/hack/verify-build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/hack/version.sh b/hack/version.sh index 3b4736a47d0f..174b88e6b221 100755 --- a/hack/version.sh +++ b/hack/version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright 2014 The Kubernetes Authors. #