btrfs-progs: tests: replace which by type -p

In some environments the which utility might not be available and the
shell builtin 'type -p' is readily available.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-02-05 14:23:11 +01:00
parent f2ffce38b9
commit 01c1bf8d8e
7 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ if [ -z "$TOP" ]; then
INTERNAL_BIN="$TOP"
else
# external, defaults to system binaries
TOP=$(dirname `which btrfs`)
TOP=$(dirname `type -p btrfs`)
TEST_TOP="$SCRIPT_DIR"
INTERNAL_BIN="$TEST_TOP"
fi

View File

@ -12,7 +12,7 @@ if [ -z "$TOP" ]; then
INTERNAL_BIN="$TOP"
else
# external, defaults to system binaries
TOP=$(dirname `which btrfs`)
TOP=$(dirname `type -p btrfs`)
TEST_TOP="$SCRIPT_DIR"
INTERNAL_BIN="$TEST_TOP"
fi

View File

@ -393,7 +393,7 @@ check_prereq()
check_global_prereq()
{
which "$1" &> /dev/null
type -p "$1" &> /dev/null
if [ $? -ne 0 ]; then
_fail "Failed system wide prerequisities: $1";
fi
@ -405,7 +405,7 @@ check_dm_target_support()
{
setup_root_helper
which dmsetup &> /dev/null
type -p dmsetup &> /dev/null
if [ $? -ne 0 ]; then
_not_run "This test requires dmsetup tool";
fi

View File

@ -13,7 +13,7 @@ if [ -z "$TOP" ]; then
INTERNAL_BIN="$TOP"
else
# external, defaults to system binaries
TOP=$(dirname `which btrfs`)
TOP=$(dirname `type -p btrfs`)
TEST_TOP="$SCRIPT_DIR"
INTERNAL_BIN="$TEST_TOP"
fi

View File

@ -12,7 +12,7 @@ if [ -z "$TOP" ]; then
INTERNAL_BIN="$TOP"
else
# external, defaults to system binaries
TOP=$(dirname `which btrfs`)
TOP=$(dirname `type -p btrfs`)
TEST_TOP="$SCRIPT_DIR"
INTERNAL_BIN="$TEST_TOP"
fi

View File

@ -12,7 +12,7 @@ if [ -z "$TOP" ]; then
INTERNAL_BIN="$TOP"
else
# external, defaults to system binaries
TOP=$(dirname `which btrfs`)
TOP=$(dirname `type -p btrfs`)
TEST_TOP="$SCRIPT_DIR"
INTERNAL_BIN="$TEST_TOP"
fi

View File

@ -12,7 +12,7 @@ if [ -z "$TOP" ]; then
INTERNAL_BIN="$TOP"
else
# external, defaults to system binaries
TOP=$(dirname `which btrfs`)
TOP=$(dirname `type -p btrfs`)
TEST_TOP="$SCRIPT_DIR"
INTERNAL_BIN="$TEST_TOP"
fi