Skip to content

Commit

Permalink
Use bash binary from env instead of /bin/bash for scripts
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
saschagrunert committed Aug 17, 2020
1 parent 96fb5dc commit ba9f18e
Show file tree
Hide file tree
Showing 61 changed files with 65 additions and 62 deletions.
2 changes: 1 addition & 1 deletion contrib/build_rpm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -euxo pipefail

# returned path can vary: /usr/bin/dnf /bin/dnf ...
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/add_second_partition.sh
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/apiv2_test.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 contrib/cirrus/build_release.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 contrib/cirrus/build_swagger.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 contrib/cirrus/build_vm_images.sh
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)/lib.sh
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/check_image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -eo pipefail

Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/container_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -xeo pipefail

export GOPATH=/var/tmp/go
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/integration_test.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 contrib/cirrus/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ install_scl_git() {
echo "Installing SoftwareCollections updated 'git' version."
ooe.sh $SUDO yum -y install rh-git29
cat << "EOF" | $SUDO tee /usr/bin/git
#!/bin/bash
#!/usr/bin/env bash
scl enable rh-git29 -- git $@
EOF
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/lib.sh.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Unit tests for some functions in lib.sh
#
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/logcollector.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 contrib/cirrus/networking.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script attempts basic confirmation of functional networking
# by connecting to a set of essential external servers and failing
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/notice_branch_failure.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 contrib/cirrus/ooe.sh
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/fedora_base-setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# N/B: This script is not intended to be run by humans. It is used to configure the
# fedora base image for importing, so that it will boot in GCE
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/fedora_packaging.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script is called from fedora_setup.sh and various Dockerfiles.
# It's not intended to be used outside of those contexts. It assumes the lib.sh
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/fedora_setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script is called by packer on the subject fedora VM, to setup the podman
# build/test environment. It's not intended to be used outside of this context.
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/image-builder-image_base-setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script is called by packer on a vanilla CentOS VM, to setup the image
# used for building images FROM base images. It's not intended to be used
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/make-user-data.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script is utilized by Makefile, it's not intended to be run by humans

Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/prior-fedora_base-setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# N/B: This script is not intended to be run by humans. It is used to configure the
# fedora base image for importing, so that it will boot in GCE
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/systemd_banish.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set +e # Not all of these exist on every platform

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

# This script is called from ubuntu_setup.sh and various Dockerfiles.
# It's not intended to be used outside of those contexts. It assumes the lib.sh
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/ubuntu_setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script is called by packer on the subject Ubuntu VM, to setup the podman
# build/test environment. It's not intended to be used outside of this context.
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/packer/xfedora_setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script is called by packer on the subject fedora VM, to setup the podman
# build/test environment. It's not intended to be used outside of this context.
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/rootless_test.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 contrib/cirrus/setup_container_environment.sh
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)/lib.sh
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/setup_environment.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 contrib/cirrus/success.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 contrib/cirrus/system_test.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 contrib/cirrus/unit_test.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 contrib/cirrus/update_meta.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

source $(dirname $0)/lib.sh

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

set -eo pipefail

Expand Down
2 changes: 1 addition & 1 deletion contrib/gate/entrypoint.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 contrib/imgprune/entrypoint.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 contrib/imgts/entrypoint.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 contrib/imgts/lib_entrypoint.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 contrib/upldrel/entrypoint.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
3 changes: 2 additions & 1 deletion docs/remote-docs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
# Assemble remote man pages for darwin or windows from markdown files
set -e

PLATFORM=$1 ## linux, windows or darwin
TARGET=${2} ## where to output files
Expand Down
2 changes: 1 addition & 1 deletion hack/apparmor_tag.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
if pkg-config libapparmor 2> /dev/null ; then
echo apparmor
fi
2 changes: 1 addition & 1 deletion hack/btrfs_installed_tag.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF
#include <btrfs/ioctl.h>
EOF
Expand Down
2 changes: 1 addition & 1 deletion hack/btrfs_tag.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF
#include <btrfs/version.h>
EOF
Expand Down
2 changes: 1 addition & 1 deletion hack/check_root.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
if ! [ $(id -u) = 0 ]; then
echo "Please run as root! '$@' requires root privileges."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion hack/get_ci_vm.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/get_release_info.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# This script produces various bits of metadata needed by Makefile. Using
# a script allows uniform behavior across multiple environments and
Expand Down
3 changes: 2 additions & 1 deletion hack/golangci-lint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash -e
#!/usr/bin/env bash

# Need to run linter twice to cover all the build tags code paths
set -e

declare -A BUILD_TAGS
# TODO: add systemd tag
Expand Down
2 changes: 1 addition & 1 deletion hack/install_bats.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
3 changes: 2 additions & 1 deletion hack/install_catatonit.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash -e
#!/usr/bin/env bash
BASE_PATH="/usr/libexec/podman"
CATATONIT_PATH="${BASE_PATH}/catatonit"
CATATONIT_VERSION="v0.1.4"
set -e

if [ -f $CATATONIT_PATH ]; then
echo "skipping ... catatonit is already installed"
Expand Down
2 changes: 1 addition & 1 deletion hack/install_golangci.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/libdm_tag.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
tmpdir="$PWD/tmp.$RANDOM"
mkdir -p "$tmpdir"
trap 'rm -fr "$tmpdir"' EXIT
Expand Down
2 changes: 1 addition & 1 deletion hack/man-page-checker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# man-page-checker - validate and cross-reference man page names
#
Expand Down
2 changes: 1 addition & 1 deletion hack/podman-commands.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Compare commands listed by 'podman help' against those in 'man podman'.
# Recurse into subcommands as well.
Expand Down
2 changes: 1 addition & 1 deletion hack/podmanv2-retry
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# podman-try - try running a command via PODMAN1; use PODMAN2 as fallback
#
Expand Down
2 changes: 1 addition & 1 deletion hack/selinux_tag.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
if pkg-config libselinux 2> /dev/null ; then
echo selinux
fi
2 changes: 1 addition & 1 deletion hack/tree_status.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

SUGGESTION="${SUGGESTION:-sync the vendor.conf and commit all changes.}"
Expand Down
2 changes: 1 addition & 1 deletion test/apiv2/test-apiv2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Usage: test-apiv2 [PORT]
#
Expand Down
2 changes: 1 addition & 1 deletion test/system/400-unprivileged-access.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ load helpers
# as a user, the parent directory must be world-readable.
test_script=$PODMAN_TMPDIR/fail-if-writable
cat >$test_script <<"EOF"
#!/bin/bash
#!/usr/bin/env bash

path="$1"

Expand Down
2 changes: 1 addition & 1 deletion test/system/helpers.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# regression tests for helpers.bash
#
Expand Down
4 changes: 2 additions & 2 deletions test/test_podman_baseline.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# test_podman_baseline.sh
# A script to be run at the command line with Podman installed.
# This should be run against a new kit to provide base level testing
Expand Down Expand Up @@ -215,7 +215,7 @@ podman run $image ls /
########
FILE=./runecho.sh
/bin/cat <<EOM >$FILE
#!/bin/bash
#!/usr/bin/env bash
for i in {1..9};
do
echo "This is a new container pull ipbabble [" \$i "]"
Expand Down
2 changes: 1 addition & 1 deletion test/test_podman_build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# test_podman_build.sh
#
Expand Down
2 changes: 1 addition & 1 deletion test/test_podman_pods.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# test_podman_pods.sh
# A script to be run at the command line with Podman installed.
# This should be run against a new kit to provide base level testing
Expand Down

0 comments on commit ba9f18e

Please sign in to comment.