Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: Use bash-builtin command -v instead of external which #555

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/copr-build-srpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#
# Authors: Daniel Kopecek <[email protected]>
#
CURL=$(which curl)
JQ=$(which jq)
CURL=$(command -v curl)
JQ=$(command -v jq)

if [ -z "$CURL" ]; then
echo "Required curl command missing. Aborting."
Expand Down
18 changes: 9 additions & 9 deletions scripts/usb-descriptor-collect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
#
set -e -o pipefail

SED=$(which sed)
FIND=$(which find)
LSUSB=$(which lsusb)
SHA1SUM=$(which sha1sum)
TAR=$(which tar)
MKTEMP=$(which mktemp)
CP=$(which cp)
WC=$(which wc)
RM=$(which rm)
SED=$(command -v sed)
FIND=$(command -v find)
LSUSB=$(command -v lsusb)
SHA1SUM=$(command -v sha1sum)
TAR=$(command -v tar)
MKTEMP=$(command -v mktemp)
CP=$(command -v cp)
WC=$(command -v wc)
RM=$(command -v rm)

TEMPDIR=$($MKTEMP -d --tmpdir usb-descriptor-collect.XXXXXX || (echo "Failed to create temporary directory"; exit 1))
ROOTDIR="$TEMPDIR/usb-descriptor-data"
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Source/CheckScripts/spell-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
# check-path-exclude: doc/FOSDEM-2016/*
#
##################
ASPELL=$(which aspell)
PANDOC=$(which pandoc)
ASPELL=$(command -v aspell)
PANDOC=$(command -v pandoc)

SOURCE_FILEPATH="$1"

Expand Down
2 changes: 1 addition & 1 deletion src/Tests/bash-testlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function execute()
local valgrind=""

if [ -n "$USBGUARD_TESTS_VALGRIND" ]; then
valgrind="$(which valgrind)"
valgrind="$(command -v valgrind)"
fi

if [ "$USBGUARD_TESTS_VALGRIND" = "off" ]; then
Expand Down