From c71eadb2b96c041a3696a33941c2ce8112ea5b4c Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Mon, 17 Aug 2020 11:23:44 +0200 Subject: [PATCH] Use `bash` binary from env instead of /bin/bash for scripts It's not possible to run any of the scripts on distributions which do have `bash` not in `/bin`. This is being fixed by using `/usr/bin/env bash` instead. Signed-off-by: Sascha Grunert --- contrib/cirrus/add_second_partition.sh | 2 +- contrib/cirrus/build_and_test.sh | 2 +- contrib/cirrus/lib.sh.t | 2 +- contrib/cirrus/ooe.sh | 2 +- contrib/cirrus/setup.sh | 2 +- hack/btrfs_tag.sh | 20 ++++++++++---------- hack/gccgo-wrapper.sh | 2 +- hack/generate-authors.sh | 2 +- hack/get_ci_vm.sh | 2 +- hack/git-validation.sh | 2 +- hack/gofmt.sh | 2 +- hack/govet.sh | 2 +- hack/libdm_tag.sh | 2 +- tests/helpers.bash | 2 +- tests/test_drivers.bash | 2 +- tests/test_runner.bash | 2 +- vagrant/provision.sh | 2 +- vagrant/runinvm.sh | 2 +- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/contrib/cirrus/add_second_partition.sh b/contrib/cirrus/add_second_partition.sh index 73db192c55..3c2f9f0564 100644 --- a/contrib/cirrus/add_second_partition.sh +++ b/contrib/cirrus/add_second_partition.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # N/B: This script could mega f*!@up your disks if run by mistake. # it is left without the execute-bit on purpose! diff --git a/contrib/cirrus/build_and_test.sh b/contrib/cirrus/build_and_test.sh index 4cf149c389..c40356a301 100755 --- a/contrib/cirrus/build_and_test.sh +++ b/contrib/cirrus/build_and_test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/contrib/cirrus/lib.sh.t b/contrib/cirrus/lib.sh.t index 1f05b3bb59..36a0b50685 100755 --- a/contrib/cirrus/lib.sh.t +++ b/contrib/cirrus/lib.sh.t @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Unit tests for some functions in lib.sh # diff --git a/contrib/cirrus/ooe.sh b/contrib/cirrus/ooe.sh index 3c8a0409dd..0966b5ce85 100755 --- a/contrib/cirrus/ooe.sh +++ b/contrib/cirrus/ooe.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script executes a command while logging all output to a temporary # file. If the command exits non-zero, then all output is sent to the console, diff --git a/contrib/cirrus/setup.sh b/contrib/cirrus/setup.sh index d7e49366ed..644f2c8770 100755 --- a/contrib/cirrus/setup.sh +++ b/contrib/cirrus/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/hack/btrfs_tag.sh b/hack/btrfs_tag.sh index ea210f0ebb..18a9d608dd 100755 --- a/hack/btrfs_tag.sh +++ b/hack/btrfs_tag.sh @@ -1,17 +1,17 @@ -#!/bin/bash -if test $(${GO:-go} env GOOS) != "linux" ; then - exit 0 +#!/usr/bin/env bash +if test $(${GO:-go} env GOOS) != "linux"; then + exit 0 fi -cc -E - > /dev/null 2> /dev/null <<- EOF +cc -E - >/dev/null 2>/dev/null <<-EOF #include EOF -if test $? -ne 0 ; then - echo exclude_graphdriver_btrfs +if test $? -ne 0; then + echo exclude_graphdriver_btrfs else - cc -E - > /dev/null 2> /dev/null <<- EOF + cc -E - >/dev/null 2>/dev/null <<-EOF #include EOF - if test $? -ne 0 ; then - echo btrfs_noversion - fi + if test $? -ne 0; then + echo btrfs_noversion + fi fi diff --git a/hack/gccgo-wrapper.sh b/hack/gccgo-wrapper.sh index e86b5404be..9ef0b6d08d 100755 --- a/hack/gccgo-wrapper.sh +++ b/hack/gccgo-wrapper.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Work around, based on one described in https://github.com/golang/go/issues/15628 # diff --git a/hack/generate-authors.sh b/hack/generate-authors.sh index e78a97f962..680bdb7b3f 100755 --- a/hack/generate-authors.sh +++ b/hack/generate-authors.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.." diff --git a/hack/get_ci_vm.sh b/hack/get_ci_vm.sh index 789d1fd45b..17fabe8af4 100755 --- a/hack/get_ci_vm.sh +++ b/hack/get_ci_vm.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/hack/git-validation.sh b/hack/git-validation.sh index 9a0e6061d7..d31b4eb48b 100755 --- a/hack/git-validation.sh +++ b/hack/git-validation.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash export PATH=${GOPATH%%:*}/bin:${PATH} export GIT_VALIDATION=tests/tools/build/git-validation if [ ! -x "$GIT_VALIDATION" ]; then diff --git a/hack/gofmt.sh b/hack/gofmt.sh index 99e0cd7ef8..99222e4dac 100755 --- a/hack/gofmt.sh +++ b/hack/gofmt.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if test $(find -name "*.go" -not -path "*/vendor/*" -print0 | xargs -n 1 -0 gofmt -s -l | wc -l) -ne 0 ; then echo Error: source files are not formatted according to recommendations. Run \"gofmt -s -w\" on: find -name "*.go" -not -path "*/vendor/*" -print0 | xargs -n 1 -0 gofmt -s -l diff --git a/hack/govet.sh b/hack/govet.sh index d5a1c98f75..da6418810f 100755 --- a/hack/govet.sh +++ b/hack/govet.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash for package in $(go list ./... | grep -v /vendor/) ; do if ! go vet ${package} ; then echo Error: source package ${package} does not pass go vet. diff --git a/hack/libdm_tag.sh b/hack/libdm_tag.sh index f9e785650e..b5eb4bf7ba 100755 --- a/hack/libdm_tag.sh +++ b/hack/libdm_tag.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if test $(${GO:-go} env GOOS) != "linux" ; then exit 0 fi diff --git a/tests/helpers.bash b/tests/helpers.bash index f4cf37e5a6..bf3ca6e7f9 100755 --- a/tests/helpers.bash +++ b/tests/helpers.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash STORAGE_BINARY=${STORAGE_BINARY:-$(dirname ${BASH_SOURCE})/../containers-storage} TESTSDIR=${TESTSDIR:-$(dirname ${BASH_SOURCE})} diff --git a/tests/test_drivers.bash b/tests/test_drivers.bash index 2b54068517..f552260352 100755 --- a/tests/test_drivers.bash +++ b/tests/test_drivers.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash TMPDIR=${TMPDIR:-/var/tmp} diff --git a/tests/test_runner.bash b/tests/test_runner.bash index a9ff2575d8..214a085cf4 100755 --- a/tests/test_runner.bash +++ b/tests/test_runner.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" diff --git a/vagrant/provision.sh b/vagrant/provision.sh index cd7befaa0d..a265fe695e 100755 --- a/vagrant/provision.sh +++ b/vagrant/provision.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -xe source /etc/os-release diff --git a/vagrant/runinvm.sh b/vagrant/runinvm.sh index 42c535e089..9ac6fbe684 100755 --- a/vagrant/runinvm.sh +++ b/vagrant/runinvm.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e export PKG='github.com/containers/storage' export VAGRANT_MACHINES="fedora debian"