all: avoid GNU "which" from shell scripts

"which" is a separate package and may not be installed.
Also, shell has a built-in command for the same purpose.
Use that.
This commit is contained in:
Thomas Haller
2020-12-11 11:11:57 +01:00
parent b9d4026f85
commit d07cd5dbf2
9 changed files with 14 additions and 14 deletions

View File

@@ -36,7 +36,7 @@ _is_true() {
}
USE_CCACHE=0
if which ccache &>/dev/null; then
if command -v ccache &>/dev/null; then
USE_CCACHE=1
export PATH="/usr/lib64/ccache:/usr/lib/ccache${PATH:+:${PATH}}"
fi

View File

@@ -38,7 +38,7 @@ if ! podman container exists "$PODNAME" ; then
-v "$DIR:/tmp/NetworkManager:Z" \
-w /tmp/NetworkManager \
fedora:33 \
/bin/bash -c 'dnf upgrade -y && dnf install -y git which /usr/bin/clang-format && ./contrib/scripts/nm-code-format.sh -i'
/bin/bash -c 'dnf upgrade -y && dnf install -y git /usr/bin/clang-format && ./contrib/scripts/nm-code-format.sh -i'
exit 0
fi

View File

@@ -37,7 +37,7 @@ EXCLUDE=":(exclude)shared/systemd/src
:(exclude)shared/c-stdaux
:(exclude)shared/n-acd"
if ! which clang-format &> /dev/null; then
if ! command -v clang-format &> /dev/null; then
echo -n "Error: clang-format is not installed, "
echo "on RHEL/Fedora/CentOS run 'dnf install clang-tools-extra'"
exit 1