Skip to content

Commit

Permalink
Fix bash_package_installed macro
Browse files Browse the repository at this point in the history
dkpg-query will return "not-installed" for uninstalled pkg which also passes the grep pattern match
  • Loading branch information
alanmcanonical committed Jul 9, 2024
1 parent a2c51f1 commit f252f24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shared/macros/10-bash.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}}
Expand Down

0 comments on commit f252f24

Please sign in to comment.