Skip to content

Commit

Permalink
Fix dpkg package applicability check in bash
Browse files Browse the repository at this point in the history
The applicability check was matching packages
with `installed` and `not-installed` status.
  • Loading branch information
mpurg committed Jan 22, 2025
1 parent 25cd0c5 commit 2207ea4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shared/macros/10-bash.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2142,9 +2142,9 @@ This macro creates a Bash conditional which uses dpkg to check if a package pass
#}}
{{%- macro bash_pkg_conditional_dpkg(package, op=None, ver=None) -%}}
{{%- if ver -%}}
dpkg-query --show --showformat='${db:Status-Status}\n' '{{{ package }}}' 2>/dev/null | grep -q installed && {{{ bash_compare_version_dpkg(package, op, ver) }}}
dpkg-query --show --showformat='${db:Status-Status}\n' '{{{ package }}}' 2>/dev/null | grep -q '^installed' && {{{ bash_compare_version_dpkg(package, op, ver) }}}
{{%- else -%}}
dpkg-query --show --showformat='${db:Status-Status}\n' '{{{ package }}}' 2>/dev/null | grep -q installed
dpkg-query --show --showformat='${db:Status-Status}\n' '{{{ package }}}' 2>/dev/null | grep -q '^installed'
{{%- endif -%}}
{{%- endmacro -%}}

Expand Down

0 comments on commit 2207ea4

Please sign in to comment.