From b0fa5381c10e64900a00507e474d4131f1325ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 11 Sep 2018 05:07:38 +0200 Subject: [PATCH] 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. --- .../org_qubes_os_initial_setup/gui/spokes/qubes_os.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qubes-anaconda-addon/org_qubes_os_initial_setup/gui/spokes/qubes_os.py b/qubes-anaconda-addon/org_qubes_os_initial_setup/gui/spokes/qubes_os.py index f545067..6033823 100644 --- a/qubes-anaconda-addon/org_qubes_os_initial_setup/gui/spokes/qubes_os.py +++ b/qubes-anaconda-addon/org_qubes_os_initial_setup/gui/spokes/qubes_os.py @@ -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)'),