Skip to content

Commit

Permalink
Fix build on platforms with bash not under /bin/
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
booxter committed Mar 6, 2019
1 parent 432f91f commit b944b0b
Show file tree
Hide file tree
Showing 40 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion cluster/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion cluster/clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion cluster/cli.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

source hack/common.sh
Expand Down
2 changes: 1 addition & 1 deletion cluster/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion cluster/down.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

source hack/common.sh
source cluster/$KUBEVIRT_PROVIDER/provider.sh
Expand Down
2 changes: 1 addition & 1 deletion cluster/ephemeral-provider-common.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/external/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

function _kubectl() {
kubectl "$@"
Expand Down
2 changes: 1 addition & 1 deletion cluster/k8s-1.10.11/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/k8s-1.11.0/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/k8s-genie-1.11.1/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/k8s-multus-1.13.3/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/kubectl.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion cluster/local/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

function _cert_dir() {
echo $GOPATH/src/kubevirt.io/kubevirt/cluster/local/certs
Expand Down
2 changes: 1 addition & 1 deletion cluster/os-3.11.0-crio/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/os-3.11.0-multus/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/os-3.11.0/provider.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion cluster/up.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

source hack/common.sh
source cluster/$KUBEVIRT_PROVIDER/provider.sh
Expand Down
2 changes: 1 addition & 1 deletion cluster/virtctl.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/bazel-generate.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion hack/bootstrap-ginkgo.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion hack/build-copy-artifacts.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/build-docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/build-func-tests-container.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/build-func-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/build-go.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/build-manifests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/builder/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

SCRIPT_DIR="$(
cd "$(dirname "$BASH_SOURCE[0]")"
Expand Down
2 changes: 1 addition & 1 deletion hack/builder/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
set -o pipefail

Expand Down
2 changes: 1 addition & 1 deletion hack/builder/publish.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion hack/check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

source hack/common.sh
Expand Down
2 changes: 1 addition & 1 deletion hack/common.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

KUBEVIRT_DIR="$(
cd "$(dirname "$BASH_SOURCE[0]")/../"
Expand Down
2 changes: 1 addition & 1 deletion hack/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion hack/dep-prune.sh
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
2 changes: 1 addition & 1 deletion hack/dockerized
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

source $(dirname "$0")/common.sh
Expand Down
2 changes: 1 addition & 1 deletion hack/functests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# This file is part of the KubeVirt project
#
Expand Down
2 changes: 1 addition & 1 deletion hack/gen-swagger-doc/gen-swagger-docs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# gen-swagger-docs.sh $API_VERSION $OUTPUT_FORMAT
# API_VERSION=v1
Expand Down
2 changes: 1 addition & 1 deletion hack/generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion hack/goveralls.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion hack/verify-build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion hack/version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright 2014 The Kubernetes Authors.
#
Expand Down

0 comments on commit b944b0b

Please sign in to comment.