Use command -v rather than which

Which is technically not POSIX and command -v works everywhere. This fixes
building and running the test suite on openSUSE Tumbleweed.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This commit is contained in:
Zygmunt Krynicki 2024-11-25 13:54:03 +01:00 committed by Zygmunt Krynicki
parent f58fe9cd52
commit 4b0adc63f5
3 changed files with 5 additions and 5 deletions

View file

@ -35,7 +35,7 @@ VERSION=$(shell cat $(COMMONDIR)/Version)
pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
map = $(foreach a,$(2),$(call $(1),$(a)))
AWK:=$(shell which awk)
AWK:=$(shell command -v awk)
ifndef AWK
$(error awk utility required for build but not available)
endif

View file

@ -27,7 +27,7 @@ manually, or build against in-tree libapparmor.${nl}\
endif # LIBAPPARMOR not set
LDLIBS += $(LIBAPPARMOR)
AA_EXEC = $(shell which aa-exec)
AA_EXEC = $(shell command -v aa-exec)
ifeq ($(AA_EXEC),)
AA_EXEC_ERROR_MESSAGE = $(error ${nl}\
************************************************************************${nl}\
@ -166,7 +166,7 @@ SRC+=syscall_sysctl.c
endif
# Only do xattrs_profile test if we have the required setfattr binary
ifneq (,$(shell which -s setfattr && echo TRUE))
ifneq (,$(shell command -v setfattr))
SRC+=xattrs_profile.c
else
$(warning ${nl}\
@ -295,7 +295,7 @@ TESTS=aa_exec \
nfs
# Only do xattrs_profile test if we have the required setfattr binary
ifneq (,$(shell which -s setfattr && echo TRUE))
ifneq (,$(shell command -v setfattr))
TESTS+=xattrs_profile
endif

View file

@ -29,5 +29,5 @@ runchecktest "Complain mode profile (file exec no permission entry)" pass exec e
# This test will fail on a kernel that doesn't have
# https://lists.ubuntu.com/archives/apparmor/2024-August/013338.html applied
genprofile -C $(which echo):cx
genprofile -C $(command -v echo):cx
runchecktest "Complain mode profile (file exec cx permission entry)" pass exec echo PASS