summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Jones <thj@freebsd.org>2024-01-18 14:51:44 +0000
committerDamjan Marion <dmarion@0xa5.net>2024-01-19 12:30:01 +0000
commitc3b416c49253bcf3223d2aec8c5ca06f0c78e6f9 (patch)
tree9502543d041b75820d2137cffe00c74978c7561c
parentca75cd83b51895e94326117cf116c5d25e6c77da (diff)
build: Explicitly use bash for shell scripts
VPP requires bash for all shell scripts. Align shebang lines in build and test scripts to look up the location of bash rather than hard coding '/bin/bash'. Look up the location of bash for makefiles. Type: improvement Change-Id: I23b705d81d60389fa8af61c680cf0abd74f0ea24 Signed-off-by: Tom Jones <thj@freebsd.org>
-rw-r--r--Makefile2
-rw-r--r--build-root/Makefile6
-rwxr-xr-xbuild-root/scripts/set-rpath2
-rw-r--r--build/external/Makefile2
-rwxr-xr-xextras/vagrant/build.sh2
-rwxr-xr-xextras/vagrant/clearinterfaces.sh2
-rwxr-xr-xextras/vagrant/install.sh2
-rwxr-xr-xextras/vagrant/run.sh2
-rwxr-xr-xextras/vagrant/update.sh2
-rwxr-xr-xextras/vagrant/vcl_test.sh2
-rwxr-xr-xsrc/scripts/generate_version_h2
-rwxr-xr-xsrc/scripts/remove-rpath2
-rw-r--r--src/scripts/vnet/dhcp/left-ping-target.sh2
-rwxr-xr-xtest/scripts/compress_failed.sh2
-rwxr-xr-xtest/scripts/run.sh2
-rwxr-xr-xtest/scripts/run_in_venv_with_cleanup.sh2
-rwxr-xr-xtest/scripts/setsid_wrapper.sh2
-rwxr-xr-xtest/scripts/socket_test.sh2
-rwxr-xr-xtest/scripts/test-loop.sh2
19 files changed, 21 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index ccfc2a50531..d82a625436b 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@
export WS_ROOT=$(CURDIR)
export BR=$(WS_ROOT)/build-root
CCACHE_DIR?=$(BR)/.ccache
-SHELL:=/bin/bash
+SHELL:=$(shell which bash)
GDB?=gdb
PLATFORM?=vpp
SAMPLE_PLUGIN?=no
diff --git a/build-root/Makefile b/build-root/Makefile
index d35b7a10aeb..6416de27336 100644
--- a/build-root/Makefile
+++ b/build-root/Makefile
@@ -39,7 +39,7 @@
######################################################################
# Scripts require non-POSIX parts of bash
-SHELL := /bin/bash
+SHELL := $(shell which bash)
# Where this makefile lives
MU_BUILD_ROOT_DIR = $(shell pwd)
@@ -962,7 +962,7 @@ $(PLATFORM_IMAGE_DIR)/ro.img ro-image: $(patsubst %,%-find-source,$(ROOT_PACKAGE
chmod 0755 $${tmp_dir} ; \
cd $${tmp_dir} ; \
trap "rm -rf $${tmp_dir}" err ; \
- fakeroot /bin/bash -c "{ \
+ fakeroot $(SHELL) -c "{ \
set -eu$(BUILD_DEBUG) ; \
$(MAKE) -C $(MU_BUILD_ROOT_DIR) IMAGE_INSTALL_DIR=$${tmp_dir} \
$(patsubst %,%-image_install, \
@@ -1054,7 +1054,7 @@ rw-image: rw-image-check-type ro-image
chmod 0755 $${tmp_dir} ; \
cd $${tmp_dir} ; \
trap "rm -rf $${tmp_dir}" err ; \
- fakeroot /bin/bash -c "{ \
+ fakeroot $(SHELL) -c "{ \
set -eu$(BUILD_DEBUG) ; \
$(linuxrc_makedev) ; \
$(call rw_image_embed_ro_image_fn,$${ro_image}) ; \
diff --git a/build-root/scripts/set-rpath b/build-root/scripts/set-rpath
index f20ff3f6f40..805f11d66e6 100755
--- a/build-root/scripts/set-rpath
+++ b/build-root/scripts/set-rpath
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (c) 2015 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/build/external/Makefile b/build/external/Makefile
index 1e1f5da1d1f..a445d7b21ee 100644
--- a/build/external/Makefile
+++ b/build/external/Makefile
@@ -12,7 +12,7 @@
# limitations under the License.
# Scripts require non-POSIX parts of bash
-SHELL := /bin/bash
+SHELL := $(shell which bash)
DL_CACHE_DIR = $(HOME)/Downloads
MAKE ?= make
diff --git a/extras/vagrant/build.sh b/extras/vagrant/build.sh
index 0e63947a8b5..631b9909d3e 100755
--- a/extras/vagrant/build.sh
+++ b/extras/vagrant/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Get Command Line arguements if present
VPP_DIR=$1
diff --git a/extras/vagrant/clearinterfaces.sh b/extras/vagrant/clearinterfaces.sh
index 31a63098e87..50b96f0d8b0 100755
--- a/extras/vagrant/clearinterfaces.sh
+++ b/extras/vagrant/clearinterfaces.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Capture all the interface IPs, in case we need them later
ip -o addr show > ~vagrant/ifconfiga
diff --git a/extras/vagrant/install.sh b/extras/vagrant/install.sh
index cfe5fe5b2d0..67a2e4fb990 100755
--- a/extras/vagrant/install.sh
+++ b/extras/vagrant/install.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Get Command Line arguements if present
VPP_DIR=$1
diff --git a/extras/vagrant/run.sh b/extras/vagrant/run.sh
index 3e87e259442..be2d8425903 100755
--- a/extras/vagrant/run.sh
+++ b/extras/vagrant/run.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Figure out what system we are running on
if [ "$(uname)" <> "Darwin" ] ; then
diff --git a/extras/vagrant/update.sh b/extras/vagrant/update.sh
index 3fb456b26eb..e56e6ba004e 100755
--- a/extras/vagrant/update.sh
+++ b/extras/vagrant/update.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Make sure that we get the hugepages we need on provision boot
# Note: The package install should take care of this at the end
diff --git a/extras/vagrant/vcl_test.sh b/extras/vagrant/vcl_test.sh
index 5d58d73745f..2bad0f6e14f 100755
--- a/extras/vagrant/vcl_test.sh
+++ b/extras/vagrant/vcl_test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
if [ -n "$1" ]; then
VPP_DIR=$1
diff --git a/src/scripts/generate_version_h b/src/scripts/generate_version_h
index 59123684d8d..cdcdf5dd42a 100755
--- a/src/scripts/generate_version_h
+++ b/src/scripts/generate_version_h
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
: ${VPP_BUILD_USER:=$(whoami)}
: ${VPP_BUILD_HOST:=$(hostname)}
DATE_FMT="+%Y-%m-%dT%H:%M:%S"
diff --git a/src/scripts/remove-rpath b/src/scripts/remove-rpath
index 3e20b06dbfa..b6df461e464 100755
--- a/src/scripts/remove-rpath
+++ b/src/scripts/remove-rpath
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright (c) 2015 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/src/scripts/vnet/dhcp/left-ping-target.sh b/src/scripts/vnet/dhcp/left-ping-target.sh
index 2edc2a50eaa..4dab842b819 100644
--- a/src/scripts/vnet/dhcp/left-ping-target.sh
+++ b/src/scripts/vnet/dhcp/left-ping-target.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# to obtain dhcp address from leftpeer
dhclient -d -v eth1
diff --git a/test/scripts/compress_failed.sh b/test/scripts/compress_failed.sh
index ff17d244629..7e2cd9c5512 100755
--- a/test/scripts/compress_failed.sh
+++ b/test/scripts/compress_failed.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
if [ "$(ls -A ${FAILED_DIR})" ]
then
diff --git a/test/scripts/run.sh b/test/scripts/run.sh
index 51c1c62df9d..504edd677cc 100755
--- a/test/scripts/run.sh
+++ b/test/scripts/run.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
ff="0"
items=
diff --git a/test/scripts/run_in_venv_with_cleanup.sh b/test/scripts/run_in_venv_with_cleanup.sh
index af32f87ea5d..3f9d44ff4b5 100755
--- a/test/scripts/run_in_venv_with_cleanup.sh
+++ b/test/scripts/run_in_venv_with_cleanup.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
rv=0
diff --git a/test/scripts/setsid_wrapper.sh b/test/scripts/setsid_wrapper.sh
index 030c3b079de..550c7b94778 100755
--- a/test/scripts/setsid_wrapper.sh
+++ b/test/scripts/setsid_wrapper.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
cmd=$1
force_foreground=$2
diff --git a/test/scripts/socket_test.sh b/test/scripts/socket_test.sh
index b94a2f344b7..3ba739a8083 100755
--- a/test/scripts/socket_test.sh
+++ b/test/scripts/socket_test.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
#
# socket_test.sh -- script to run socket tests.
#
diff --git a/test/scripts/test-loop.sh b/test/scripts/test-loop.sh
index 51f5d5cef58..b825f2b4cc8 100755
--- a/test/scripts/test-loop.sh
+++ b/test/scripts/test-loop.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
function usage() {
echo "$0" 1>&2