Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure DNF5 to execute post-update actions #523

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion package-managers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 4 additions & 0 deletions package-managers/qubes-post-update.actions
Original file line number Diff line number Diff line change
@@ -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
13 changes: 10 additions & 3 deletions qubes-rpc/qvm-template-repo-query
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,17 @@ 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
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
Expand All @@ -197,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
Expand Down Expand Up @@ -226,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
Expand Down Expand Up @@ -253,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
Expand Down Expand Up @@ -496,7 +504,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
Expand Down Expand Up @@ -949,11 +961,15 @@ 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
%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
Expand Down Expand Up @@ -1054,13 +1070,16 @@ 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/*
%else
%files -n python%{python3_pkgversion}-dnf-plugins-qubes-hooks
%{python3_sitelib}/dnf-plugins/*
%endif
%endif

%if 0%{?rhel} != 7
%files caja
Expand Down