From 06f86e2a02f28937c020e712b76932a0f4dfdaaa Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 6 Jul 2022 06:41:35 +0000 Subject: [PATCH] rc.apparmor.functions: only use systemd-detect-virt if it's present This is a follow-up on !812, which added a call to systemd-detect-virt. Everywhere else we don't assume that program is present, and first check if it's there before we run it. Let's do the same here. --- parser/rc.apparmor.functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parser/rc.apparmor.functions b/parser/rc.apparmor.functions index 14ccc92e2..cefa62e3e 100644 --- a/parser/rc.apparmor.functions +++ b/parser/rc.apparmor.functions @@ -91,7 +91,8 @@ is_container_with_internal_policy() { local ns_name # WSL needs to be detected explicitly - if [ "$(systemd-detect-virt --container)" = "wsl" ]; then + if [ -x /usr/bin/systemd-detect-virt ] && \ + [ "$(systemd-detect-virt --container)" = "wsl" ]; then return 0 fi