From f252f24c4c5c0ccae92f6de57ea16def832444dc Mon Sep 17 00:00:00 2001 From: wqian Date: Tue, 9 Jul 2024 14:50:12 +0100 Subject: [PATCH] Fix bash_package_installed macro dkpg-query will return "not-installed" for uninstalled pkg which also passes the grep pattern match --- shared/macros/10-bash.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/macros/10-bash.jinja b/shared/macros/10-bash.jinja index acd692c86a4..b168183ddc8 100644 --- a/shared/macros/10-bash.jinja +++ b/shared/macros/10-bash.jinja @@ -1323,7 +1323,7 @@ done #}} {{%- macro bash_package_installed(pkgname) -%}} {{%- if pkg_manager == "apt_get" -%}} -dpkg-query --show --showformat='${db:Status-Status}\n' "{{{ pkgname }}}" 2>/dev/null | grep -q installed +dpkg-query --show --showformat='${db:Status-Status}\n' "{{{ pkgname }}}" 2>/dev/null | grep -q ^installed {{%- else -%}} rpm --quiet -q "{{{ pkgname }}}" {{%- endif -%}}