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:
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user