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 <sgrunert@suse.com>
This commit is contained in:
Sascha Grunert
2020-08-17 09:18:02 +02:00
parent 96fb5dc94d
commit ba9f18e2b8
61 changed files with 65 additions and 62 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -euxo pipefail set -euxo pipefail
# returned path can vary: /usr/bin/dnf /bin/dnf ... # returned path can vary: /usr/bin/dnf /bin/dnf ...

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# N/B: This script could mega f*!@up your disks if run by mistake. # N/B: This script could mega f*!@up your disks if run by mistake.
# it is left without the execute-bit on purpose! # it is left without the execute-bit on purpose!

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e
source $(dirname $0)/lib.sh source $(dirname $0)/lib.sh

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -eo pipefail set -eo pipefail

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -xeo pipefail set -xeo pipefail
export GOPATH=/var/tmp/go export GOPATH=/var/tmp/go

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -376,7 +376,7 @@ install_scl_git() {
echo "Installing SoftwareCollections updated 'git' version." echo "Installing SoftwareCollections updated 'git' version."
ooe.sh $SUDO yum -y install rh-git29 ooe.sh $SUDO yum -y install rh-git29
cat << "EOF" | $SUDO tee /usr/bin/git cat << "EOF" | $SUDO tee /usr/bin/git
#!/bin/bash #!/usr/bin/env bash
scl enable rh-git29 -- git $@ scl enable rh-git29 -- git $@
EOF EOF

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# Unit tests for some functions in lib.sh # Unit tests for some functions in lib.sh
# #

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This script attempts basic confirmation of functional networking # This script attempts basic confirmation of functional networking
# by connecting to a set of essential external servers and failing # by connecting to a set of essential external servers and failing

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This script executes a command while logging all output to a temporary # 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, # file. If the command exits non-zero, then all output is sent to the console,

View File

@ -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 # 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 # fedora base image for importing, so that it will boot in GCE

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This script is called from fedora_setup.sh and various Dockerfiles. # 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 # It's not intended to be used outside of those contexts. It assumes the lib.sh

View File

@ -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 # 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. # build/test environment. It's not intended to be used outside of this context.

View File

@ -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 # 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 # used for building images FROM base images. It's not intended to be used

View File

@ -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 # This script is utilized by Makefile, it's not intended to be run by humans

View File

@ -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 # 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 # fedora base image for importing, so that it will boot in GCE

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set +e # Not all of these exist on every platform set +e # Not all of these exist on every platform

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This script is called from ubuntu_setup.sh and various Dockerfiles. # 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 # It's not intended to be used outside of those contexts. It assumes the lib.sh

View File

@ -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 # 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. # build/test environment. It's not intended to be used outside of this context.

View File

@ -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 # 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. # build/test environment. It's not intended to be used outside of this context.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e
source $(dirname $0)/lib.sh source $(dirname $0)/lib.sh

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
source $(dirname $0)/lib.sh source $(dirname $0)/lib.sh

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -eo pipefail set -eo pipefail

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,5 +1,6 @@
#!/bin/bash -e #!/usr/bin/env bash
# Assemble remote man pages for darwin or windows from markdown files # Assemble remote man pages for darwin or windows from markdown files
set -e
PLATFORM=$1 ## linux, windows or darwin PLATFORM=$1 ## linux, windows or darwin
TARGET=${2} ## where to output files TARGET=${2} ## where to output files

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
if pkg-config libapparmor 2> /dev/null ; then if pkg-config libapparmor 2> /dev/null ; then
echo apparmor echo apparmor
fi fi

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF cc -E - > /dev/null 2> /dev/null << EOF
#include <btrfs/ioctl.h> #include <btrfs/ioctl.h>
EOF EOF

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF cc -E - > /dev/null 2> /dev/null << EOF
#include <btrfs/version.h> #include <btrfs/version.h>
EOF EOF

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
if ! [ $(id -u) = 0 ]; then if ! [ $(id -u) = 0 ]; then
echo "Please run as root! '$@' requires root privileges." echo "Please run as root! '$@' requires root privileges."
exit 1 exit 1

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# This script produces various bits of metadata needed by Makefile. Using # This script produces various bits of metadata needed by Makefile. Using
# a script allows uniform behavior across multiple environments and # a script allows uniform behavior across multiple environments and

View File

@ -1,6 +1,7 @@
#!/bin/bash -e #!/usr/bin/env bash
# Need to run linter twice to cover all the build tags code paths # Need to run linter twice to cover all the build tags code paths
set -e
declare -A BUILD_TAGS declare -A BUILD_TAGS
# TODO: add systemd tag # TODO: add systemd tag

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,7 +1,8 @@
#!/bin/bash -e #!/usr/bin/env bash
BASE_PATH="/usr/libexec/podman" BASE_PATH="/usr/libexec/podman"
CATATONIT_PATH="${BASE_PATH}/catatonit" CATATONIT_PATH="${BASE_PATH}/catatonit"
CATATONIT_VERSION="v0.1.4" CATATONIT_VERSION="v0.1.4"
set -e
if [ -f $CATATONIT_PATH ]; then if [ -f $CATATONIT_PATH ]; then
echo "skipping ... catatonit is already installed" echo "skipping ... catatonit is already installed"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
tmpdir="$PWD/tmp.$RANDOM" tmpdir="$PWD/tmp.$RANDOM"
mkdir -p "$tmpdir" mkdir -p "$tmpdir"
trap 'rm -fr "$tmpdir"' EXIT trap 'rm -fr "$tmpdir"' EXIT

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# man-page-checker - validate and cross-reference man page names # man-page-checker - validate and cross-reference man page names
# #

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# Compare commands listed by 'podman help' against those in 'man podman'. # Compare commands listed by 'podman help' against those in 'man podman'.
# Recurse into subcommands as well. # Recurse into subcommands as well.

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# podman-try - try running a command via PODMAN1; use PODMAN2 as fallback # podman-try - try running a command via PODMAN1; use PODMAN2 as fallback
# #

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
if pkg-config libselinux 2> /dev/null ; then if pkg-config libselinux 2> /dev/null ; then
echo selinux echo selinux
fi fi

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e
SUGGESTION="${SUGGESTION:-sync the vendor.conf and commit all changes.}" SUGGESTION="${SUGGESTION:-sync the vendor.conf and commit all changes.}"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# Usage: test-apiv2 [PORT] # Usage: test-apiv2 [PORT]
# #

View File

@ -23,7 +23,7 @@ load helpers
# as a user, the parent directory must be world-readable. # as a user, the parent directory must be world-readable.
test_script=$PODMAN_TMPDIR/fail-if-writable test_script=$PODMAN_TMPDIR/fail-if-writable
cat >$test_script <<"EOF" cat >$test_script <<"EOF"
#!/bin/bash #!/usr/bin/env bash
path="$1" path="$1"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# regression tests for helpers.bash # regression tests for helpers.bash
# #

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# test_podman_baseline.sh # test_podman_baseline.sh
# A script to be run at the command line with Podman installed. # 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 # This should be run against a new kit to provide base level testing
@ -215,7 +215,7 @@ podman run $image ls /
######## ########
FILE=./runecho.sh FILE=./runecho.sh
/bin/cat <<EOM >$FILE /bin/cat <<EOM >$FILE
#!/bin/bash #!/usr/bin/env bash
for i in {1..9}; for i in {1..9};
do do
echo "This is a new container pull ipbabble [" \$i "]" echo "This is a new container pull ipbabble [" \$i "]"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
# test_podman_build.sh # test_podman_build.sh
# #

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# test_podman_pods.sh # test_podman_pods.sh
# A script to be run at the command line with Podman installed. # 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 # This should be run against a new kit to provide base level testing