From 2b54b245d615ad10f46fde711ef8070b3be5e3f1 Mon Sep 17 00:00:00 2001 From: Anastasia Cotorobai Date: Tue, 6 Aug 2019 14:17:29 +0200 Subject: [PATCH 1/2] 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']) From 865948db8823b6ad381e63d0e2977bdcbe14fa10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Wed, 7 Aug 2019 11:17:44 +0200 Subject: [PATCH 2/2] yum-plugin-hooks: package only for CentOS 7 --- Makefile | 7 ++++--- rpm_spec/core-agent.spec.in | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 855fdb2..65fee25 100644 --- a/Makefile +++ b/Makefile @@ -161,8 +161,6 @@ install-rh: install-systemd install-systemd-dropins install-sysvinit install -D -m 0644 misc/qubes-r4.repo.in $(DESTDIR)/etc/yum.repos.d/qubes-r4.repo DIST='$(DIST)'; sed -i "s/@DIST@/$${DIST%%[0-9]*}/g" $(DESTDIR)/etc/yum.repos.d/qubes-r4.repo install -d $(DESTDIR)$(LIBDIR)/yum-plugins/ - install -m 0644 misc/yum-qubes-hooks.py* $(DESTDIR)$(LIBDIR)/yum-plugins/ - install -D -m 0644 misc/yum-qubes-hooks.conf $(DESTDIR)/etc/yum/pluginconf.d/yum-qubes-hooks.conf install -d -m 755 $(DESTDIR)/etc/pki/rpm-gpg install -m 644 misc/RPM-GPG-KEY-qubes* $(DESTDIR)/etc/pki/rpm-gpg/ install -D -m 644 misc/session-stop-timeout.conf $(DESTDIR)$(LIBDIR)/systemd/system/user@.service.d/90-session-stop-timeout.conf @@ -175,7 +173,10 @@ install-rh: install-systemd install-systemd-dropins install-sysvinit install -D misc/qubes-serial-login $(DESTDIR)/$(SBINDIR)/qubes-serial-login install -D -m 0644 misc/dracut-qubes.conf \ $(DESTDIR)/usr/lib/dracut/dracut.conf.d/30-qubes.conf - +ifeq ($(shell rpm --eval %{centos_ver}),7) + install -D -m 0644 misc/yum-qubes-hooks.py $(DESTDIR)$(LIBDIR)/yum-plugins/ + install -D -m 0644 misc/yum-qubes-hooks.conf $(DESTDIR)/etc/yum/pluginconf.d/yum-qubes-hooks.conf +endif install -D -m 0644 misc/dnf-qubes-hooks.py \ $(DESTDIR)$(PYTHON2_SITELIB)/dnf-plugins/qubes-hooks.py install -D -m 0644 misc/dnf-qubes-hooks.py \ diff --git a/rpm_spec/core-agent.spec.in b/rpm_spec/core-agent.spec.in index cce10a8..f60b0c6 100644 --- a/rpm_spec/core-agent.spec.in +++ b/rpm_spec/core-agent.spec.in @@ -593,7 +593,10 @@ rm -f %{name}-%{version} %config(noreplace) /etc/qubes-suspend-module-blacklist %config(noreplace) /etc/yum.conf.d/qubes-proxy.conf %config(noreplace) /etc/yum.repos.d/qubes-r4.repo +%if 0%{?rhel} == 7 /etc/yum/pluginconf.d/yum-qubes-hooks.conf +/usr/lib/yum-plugins/yum-qubes-hooks.py* +%endif %config(noreplace) /etc/dnf/plugins/qubes-hooks.conf %config(noreplace) /etc/dconf/db/local.d/dpi /usr/lib/systemd/system/user@.service.d/90-session-stop-timeout.conf @@ -632,7 +635,6 @@ rm -f %{name}-%{version} /usr/lib/qubes/qubes-sync-clock /usr/lib/qubes/resize-rootfs /usr/lib/qubes/tinyproxy-wrapper -/usr/lib/yum-plugins/yum-qubes-hooks.py* /usr/lib/dracut/dracut.conf.d/30-qubes.conf %dir /usr/lib/qubes/init /usr/lib/qubes/init/bind-dirs.sh