From 66d68b73ce20b6a21b99bf1772e5db00ead0db52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Fri, 2 Feb 2024 23:18:21 +0000 Subject: [PATCH] use `command -v` instead `which` command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minimize build requirement. Use standard POSIX sh `command -v` instead separader external which comman. Fixes #2825 Signed-off-by: Tomasz Kłoczko --- tests/libtest.sh | 6 +++--- tests/test-delta-ed25519.sh | 2 +- tests/test-delta-sign.sh | 2 +- tests/test-delta.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/libtest.sh b/tests/libtest.sh index d1c99eab8f..e7d492f23c 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -107,7 +107,7 @@ export TEST_GPG_KEYHOME=${test_tmpdir}/gpghome export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted assert_has_setfattr() { - if ! which setfattr 2>/dev/null; then + if ! command -v setfattr 2>/dev/null; then fatal "no setfattr available to determine xattr support" fi } @@ -725,9 +725,9 @@ which_gpg () { local opt # Prefer gpg2 in case gpg refers to gpg1 - if which gpg2 &>/dev/null; then + if command -v gpg2 &>/dev/null; then gpg=gpg2 - elif which gpg &>/dev/null; then + elif command -v gpg &>/dev/null; then gpg=gpg else # Succeed but don't return anything. diff --git a/tests/test-delta-ed25519.sh b/tests/test-delta-ed25519.sh index 9e00fdb45a..87a335e61f 100755 --- a/tests/test-delta-ed25519.sh +++ b/tests/test-delta-ed25519.sh @@ -34,7 +34,7 @@ ostree_repo_init repo --mode=archive mkdir files for bin in ${bindatafiles}; do - cp $(which ${bin}) files + cp $(command -v ${bin}) files done ${CMD_PREFIX} ostree --repo=repo commit -b test -s test --tree=dir=files diff --git a/tests/test-delta-sign.sh b/tests/test-delta-sign.sh index c6e9e57ca6..632b1c7929 100755 --- a/tests/test-delta-sign.sh +++ b/tests/test-delta-sign.sh @@ -35,7 +35,7 @@ ostree_repo_init repo --mode=archive mkdir files for bin in ${bindatafiles}; do - cp $(which ${bin}) files + cp $(command -v ${bin}) files done ${CMD_PREFIX} ostree --repo=repo commit -b test -s test --tree=dir=files diff --git a/tests/test-delta.sh b/tests/test-delta.sh index 4c9e2e2d89..5b2658aa85 100755 --- a/tests/test-delta.sh +++ b/tests/test-delta.sh @@ -33,7 +33,7 @@ ostree_repo_init repo --mode=archive mkdir files for bin in ${bindatafiles}; do - cp $(which ${bin}) files + cp $(command -v ${bin}) files done ${CMD_PREFIX} ostree --repo=repo commit -b test -s test --tree=dir=files