From 070a571828b5b66aad09ac528436fbd2b82e02de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 1 Oct 2024 14:00:44 +0200 Subject: [PATCH 1/3] Use libdnf5-plugin-actions to execute post-update actions Fedora 41 uses DNF5 by default, doesn't support old (python) plugins anymore. But it has 'actions' plugin which allows executing arbitrary commands at various points of time. Use it to notify dom0 about installed updates, and refresh appmenus etc. QubesOS/qubes-issues#9244 --- package-managers/Makefile | 6 +++++- package-managers/qubes-post-update.actions | 4 ++++ rpm_spec/core-agent.spec.in | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 package-managers/qubes-post-update.actions diff --git a/package-managers/Makefile b/package-managers/Makefile index 73d53560..88765ab4 100644 --- a/package-managers/Makefile +++ b/package-managers/Makefile @@ -39,7 +39,7 @@ endif DIST ?= fc33 -.PHONY: install install-apt install-dnf install-rpm install-yum +.PHONY: install install-apt install-dnf install-dnf5 install-rpm install-yum install: install -d $(DESTDIR)$(QUBESLIBDIR) @@ -91,6 +91,10 @@ else endif install -D -m 0644 dnf-qubes-hooks.conf $(DESTDIR)$(SYSCONFDIR)/dnf/plugins/qubes-hooks.conf +install-dnf5: install-rpm + install -D -m 0644 qubes-post-update.actions \ + $(DESTDIR)$(SYSCONFDIR)/dnf/libdnf5-plugins/actions.d/qubes-post-update.actions + install-yum: install-rpm install -d $(DESTDIR)$(LIBDIR)/yum-plugins install -D -m 0644 yum-qubes-hooks.py \ diff --git a/package-managers/qubes-post-update.actions b/package-managers/qubes-post-update.actions new file mode 100644 index 00000000..2dc4ad8e --- /dev/null +++ b/package-managers/qubes-post-update.actions @@ -0,0 +1,4 @@ +# notify dom0 if all updates are installed now +post_transaction:::enabled=host-only:/usr/lib/qubes/upgrades-status-notify +# refresh appmenus, features etc +post_transaction:::enabled=host-only:/etc/qubes-rpc/qubes.PostInstall diff --git a/rpm_spec/core-agent.spec.in b/rpm_spec/core-agent.spec.in index 8f4c6bc9..88a34b96 100644 --- a/rpm_spec/core-agent.spec.in +++ b/rpm_spec/core-agent.spec.in @@ -167,6 +167,9 @@ Requires: dbus-1-tools %else Requires: dbus-tools %endif +%if 0%{?fedora} >= 41 +Requires: libdnf5-plugin-actions +%else %if 0%{?rhel} == 8 # we need to stick to related DNF python version # which is python3.6 by default @@ -174,6 +177,7 @@ Requires: python3-dnf-plugins-qubes-hooks %else Requires: python%{python3_pkgversion}-dnf-plugins-qubes-hooks %endif +%endif Requires: python%{python3_pkgversion}-setuptools # for qubes.ResizeDisk Requires: parted @@ -496,7 +500,11 @@ make -C qubes-rpc/kde DESTDIR=$RPM_BUILD_ROOT install-kde5 make -C qubes-rpc/nautilus DESTDIR=$RPM_BUILD_ROOT install make -C qubes-rpc/thunar DESTDIR=$RPM_BUILD_ROOT install +%if 0%{?fedora} >= 41 +make -C package-managers PYTHON=%{__python3} DESTDIR=$RPM_BUILD_ROOT install install-dnf5 +%else make -C package-managers PYTHON=%{__python3} DESTDIR=$RPM_BUILD_ROOT install install-dnf +%endif %if 0%{?rhel} == 7 make -C package-managers DESTDIR=$RPM_BUILD_ROOT install-yum %endif @@ -949,10 +957,14 @@ rm -f %{name}-%{version} %config(noreplace) /etc/yum.conf.d/qubes-proxy.conf %dir /etc/yum.repos.d %config(noreplace) /etc/yum.repos.d/qubes-r4.repo +%if 0%{?fedora} >= 41 +/etc/dnf/libdnf5-plugins/actions.d/qubes-post-update.actions +%else %if 0%{?rhel} == 7 /etc/yum/pluginconf.d/yum-qubes-hooks.conf /usr/lib/yum-plugins/yum-qubes-hooks.py* %endif +%endif %config(noreplace) /etc/dnf/plugins/qubes-hooks.conf %dir /etc/dconf/db/local.d %config(noreplace) /etc/dconf/db/local.d/dpi From fd441f0d3490a475a1d26217864447ecdfb670f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 1 Oct 2024 14:32:40 +0200 Subject: [PATCH 2/3] Do not build python3-dnf-plugins-qubes-hooks on Fedora >= 41 It's not relevant for DNF5 anymore. Since that subpackage had the only BR: python3-devel, move it to the main package for "qubesagent" python package build. QubesOS/qubes-issues#9244 --- rpm_spec/core-agent.spec.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rpm_spec/core-agent.spec.in b/rpm_spec/core-agent.spec.in index 88a34b96..7f6dbc13 100644 --- a/rpm_spec/core-agent.spec.in +++ b/rpm_spec/core-agent.spec.in @@ -201,6 +201,7 @@ BuildRequires: qubes-utils-devel >= 4.3.1 BuildRequires: qubes-libvchan-%{?qubes_backend_vmm}%{?!qubes_backend_vmm:@BACKEND_VMM@}-devel BuildRequires: pam-devel BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-devel BuildRequires: systemd %if 0%{?rhel} >= 8 BuildRequires: redhat-lsb @@ -230,6 +231,8 @@ Requires: (gnome-keyring if xdg-desktop-portal) %description The Qubes core files for installation inside a Qubes VM. +%if 0%{?fedora} < 41 +# not relevant anymore with DNF5 %if 0%{?rhel} == 8 %package -n python3-dnf-plugins-qubes-hooks Summary: DNF plugin for Qubes specific post-installation actions @@ -257,6 +260,7 @@ DNF plugin for Qubes specific post-installation actions: * notify dom0 that updates were installed * refresh applications shortcut list %endif +%endif %if 0%{?rhel} != 7 %package caja @@ -964,8 +968,8 @@ rm -f %{name}-%{version} /etc/yum/pluginconf.d/yum-qubes-hooks.conf /usr/lib/yum-plugins/yum-qubes-hooks.py* %endif -%endif %config(noreplace) /etc/dnf/plugins/qubes-hooks.conf +%endif %dir /etc/dconf/db/local.d %config(noreplace) /etc/dconf/db/local.d/dpi %config(noreplace) /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-notifyd.xml @@ -1066,6 +1070,8 @@ rm -f %{name}-%{version} %dir /mnt/removable %dir /rw +%if 0%{?fedora} < 41 +# not relevant anymore with DNF5 %if 0%{?rhel} == 8 %files -n python3-dnf-plugins-qubes-hooks %{plateform_python3_sitelib}/dnf-plugins/* @@ -1073,6 +1079,7 @@ rm -f %{name}-%{version} %files -n python%{python3_pkgversion}-dnf-plugins-qubes-hooks %{python3_sitelib}/dnf-plugins/* %endif +%endif %if 0%{?rhel} != 7 %files caja From 467d0cafc2b44169d3dcca2d84ba8842c135dc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 2 Oct 2024 03:45:01 +0200 Subject: [PATCH 3/3] qvm-template-repo-query: don't set pluginpath for DNF5 Setting pluginpath makes DNF5 look for plugin configs for every installed libdnf plugin. If any is missing, it fails to start. Since the downloadurl plugin isn't applicable to DNF5 don't set alternative pluginpath to avoid the problem of missing configs for other plugins. QubesOS/qubes-issues#9244 --- qubes-rpc/qvm-template-repo-query | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/qubes-rpc/qvm-template-repo-query b/qubes-rpc/qvm-template-repo-query index 2e78cb7c..7f57ad44 100755 --- a/qubes-rpc/qvm-template-repo-query +++ b/qubes-rpc/qvm-template-repo-query @@ -26,11 +26,18 @@ repodir=$(mktemp -d) trap 'rm -r "$repodir"' EXIT cat > "$repodir/template.repo" +DNF5=false +if [ "$(readlink /usr/bin/dnf)" = "dnf5" ]; then + DNF5=true +fi + OPTS+=(-y "--setopt=reposdir=${repodir}" --quiet) -# use vendored 'downloadurl' dnf-plugin (fork of 'download' plugin), to print -# all mirrors -OPTS+=("--setopt=pluginpath=/usr/lib/qubes/dnf-plugins") +if ! $DNF5; then + # use vendored 'downloadurl' dnf-plugin (fork of 'download' plugin), to print + # all mirrors + OPTS+=("--setopt=pluginpath=/usr/lib/qubes/dnf-plugins") +fi if ! command -v dnf >/dev/null; then echo "ERROR: dnf command is missing, please use newer template for your UpdateVM to download templates." >&2