From 2b54b245d615ad10f46fde711ef8070b3be5e3f1 Mon Sep 17 00:00:00 2001 From: Anastasia Cotorobai Date: Tue, 6 Aug 2019 14:17:29 +0200 Subject: [PATCH] yum-qubes-hooks: update with respect to dnf-qubes-hooks Add call to postInstall script, notify condition/ add appmenu-sync and notify-updates to conf file --- misc/yum-qubes-hooks.conf | 2 ++ misc/yum-qubes-hooks.py | 29 +++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/misc/yum-qubes-hooks.conf b/misc/yum-qubes-hooks.conf index 8e4d76c..9172fe3 100644 --- a/misc/yum-qubes-hooks.conf +++ b/misc/yum-qubes-hooks.conf @@ -1,2 +1,4 @@ [main] enabled=1 +notify-updates=1 +sync-appmenus=1 diff --git a/misc/yum-qubes-hooks.py b/misc/yum-qubes-hooks.py index 794311b..2f66321 100644 --- a/misc/yum-qubes-hooks.py +++ b/misc/yum-qubes-hooks.py @@ -22,21 +22,26 @@ from yum.plugins import TYPE_CORE -from yum.constants import * import subprocess requires_api_version = '2.4' plugin_type = (TYPE_CORE,) + def posttrans_hook(conduit): - # Get all updates available _before_ this transaction - pkg_list = conduit._base.doPackageLists(pkgnarrow='updates') - - # Get packages installed in this transaction... - ts = conduit.getTsInfo() - all = ts.getMembers() - # ...and filter them out of available updates - filtered_updates = filter(lambda x: x not in all, pkg_list.updates) - - # Notify dom0 about left updates count - subprocess.call(['/usr/lib/qubes/qrexec-client-vm', 'dom0', 'qubes.NotifyUpdates', '/bin/echo', str(len(filtered_updates))]) + if conduit.confBool('main', 'notify-updates', default=True): + # Get all updates available _before_ this transaction + pkg_list = conduit._base.doPackageLists(pkgnarrow='updates') + # Get packages installed in this transaction... + ts = conduit.getTsInfo() + all_transactions = ts.getMembers() + # ...and filter them out of available updates + filtered_updates = list( + filter(lambda x: x not in all_transactions, pkg_list.updates)) + # Notify dom0 about left updates count + subprocess.call( + ['/usr/lib/qubes/qrexec-client-vm', 'dom0', 'qubes.NotifyUpdates', + '/bin/echo', str(len(filtered_updates))]) + conduit.info(1, "Notifying dom0 about installed/removed applications") + # Notify and add app to app-menus + subprocess.call(['/etc/qubes-rpc/qubes.PostInstall'])