qubes-anaconda-addon: fix checking for versioned whonix templates

Use '*' in package name. This require using rpm -qa (instead of rpm -q).
In this case, checking exit code doesn't work, we need to check if any
package was actually listed.
pull/24/merge mm_b0fa5381
Marek Marczykowski-Górecki 6 years ago
parent fa2ad03b0b
commit b0fa5381c1
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

@ -58,8 +58,8 @@ from pyanaconda.ui.common import FirstbootOnlySpokeMixIn
__all__ = ["QubesOsSpoke"]
def is_package_installed(pkgname):
return not subprocess.call(['rpm', '-q', pkgname],
stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w'))
pkglist = subprocess.check_output(['rpm', '-qa', pkgname])
return bool(pkglist)
def usb_keyboard_present():
context = pyudev.Context()
@ -246,8 +246,8 @@ class QubesOsSpoke(FirstbootOnlySpokeMixIn, NormalSpoke):
('qvm.personal', 'qvm.work', 'qvm.untrusted', 'qvm.vault'),
depend=self.choice_network)
if (is_package_installed('qubes-template-whonix-gw') and
is_package_installed('qubes-template-whonix-ws')):
if (is_package_installed('qubes-template-whonix-gw*') and
is_package_installed('qubes-template-whonix-ws*')):
self.choice_whonix = QubesChoice(
_('Create Whonix Gateway and Workstation qubes '
'(sys-whonix, anon-whonix)'),

Loading…
Cancel
Save