Fix the offline updater to work with latest systemd

https://bugzilla.redhat.com/show_bug.cgi?id=1430920
This commit is contained in:
Kalev Lember 2017-03-24 10:51:45 +01:00
parent 8bd7472a49
commit 3a20fcd677
2 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,63 @@
From 5690867b175c49387dd799f96f8d07c67b1f4170 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 23 Mar 2017 15:37:29 -0400
Subject: [PATCH 3/3] offline-updates: various tweaks to the service file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Change description to "Update ...", because systemd uses the
Description when starting and stopping units, and "Starting Update
the OS…" better than "Starting Updates the OS…".
- Add After=dbus.socket. a54c5ae66c8f8 added Requires=, but Requires=
without After= is useless for socket units.
- Add DefaultDependencies=no to drop the dependency on basic.target,
and add Requires=sysinit.target, After=sysinit.target
systemd-journald.socket, Before=shutdown.target system-update.target
to re-add the dependencies that are necessary.
Because of the dependency on dbus.socket, which starts dbus.service,
we still have a dependency on basic.target. (As soon as a connection
to the socket is made, dbus.service will be started, and since
dbus.service has DefaultDependencies=yes, we'll wait for
basic.target to be reached.) But we might be started without our
symlink being in place and exit without doing anything. In that case
basic.target might not be needed. This allows other upgrade
mechanism which do not require dbus to proceed.
- Change OnFailure to FailureAction — more modern and nicer syntax, and
the target is started irreplaceably, which should be more robust.
- Change to Type=oneshot. The default is Type=simple, which means that
systemd considers the unit started immediately, which means that it
races with the system-update-cleanup.service which is started after
system-update.target is reached.
https://bugzilla.redhat.com/show_bug.cgi?id=1430920
---
data/packagekit-offline-update.service.in | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/data/packagekit-offline-update.service.in b/data/packagekit-offline-update.service.in
index 0b9da3a..c8e4394 100644
--- a/data/packagekit-offline-update.service.in
+++ b/data/packagekit-offline-update.service.in
@@ -1,7 +1,13 @@
[Unit]
-Description=Updates the operating system whilst offline
-Requires=dbus.socket
-OnFailure=reboot.target
+Description=Update the operating system whilst offline
+
+DefaultDependencies=no
+Requires=sysinit.target dbus.socket
+After=sysinit.target dbus.socket systemd-journald.socket
+Before=shutdown.target system-update.target
[Service]
+Type=oneshot
ExecStart=@libexecdir@/pk-offline-update
+
+FailureAction=reboot

View File

@ -14,7 +14,7 @@
Summary: Package management service
Name: PackageKit
Version: 1.1.5
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+ and LGPLv2+
URL: http://www.freedesktop.org/software/PackageKit/
Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz
@ -29,6 +29,9 @@ Provides: bundled(libdnf) = 0.7.0
# Fedora-specific: set Vendor.conf up for Fedora.
Patch0: PackageKit-0.3.8-Fedora-Vendor.conf.patch
# Fix the offline updater to work with latest systemd
# https://github.com/hughsie/PackageKit/pull/72
Patch1: 0001-offline-updates-various-tweaks-to-the-service-file.patch
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: xmlto
@ -189,6 +192,7 @@ tar -xf %{S:1}
%endif
%patch0 -p1 -b .fedora
%patch1 -p1
%build
%if 0%{?bundled_libdnf}
@ -339,6 +343,9 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :
%{_datadir}/vala/vapi/packagekit-glib2.vapi
%changelog
* Fri Mar 24 2017 Kalev Lember <klember@redhat.com> - 1.1.5-4
- Fix the offline updater to work with latest systemd (#1430920)
* Fri Mar 17 2017 Kalev Lember <klember@redhat.com> - 1.1.5-3
- Build with system libdnf