Skip to content

Commit

Permalink
use command -v instead which command
Browse files Browse the repository at this point in the history
Minimize build requirement.
Use standard POSIX sh `command -v` instead separated external which command.

Fixes ostreedev#2825

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
  • Loading branch information
kloczek committed Feb 2, 2024
1 parent 7404131 commit f10cbd1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/test-delta-ed25519.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test-delta-sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test-delta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f10cbd1

Please sign in to comment.