Merge lp:~azzar1/update-notifier/fix-1761841-v2 into lp:update-notifier/ubuntu

Proposed by Andrea Azzarone
Status: Merged
Merged at revision: 926
Proposed branch: lp:~azzar1/update-notifier/fix-1761841-v2
Merge into: lp:update-notifier/ubuntu
Diff against target: 94 lines (+30/-0)
3 files modified
debian/changelog (+8/-0)
src/update-notifier.c (+20/-0)
src/update-notifier.h (+2/-0)
To merge this branch: bzr merge lp:~azzar1/update-notifier/fix-1761841-v2
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+343540@code.launchpad.net

Commit message

Manually monitor the livepatch status file using GFileMonitor.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2018-04-09 11:35:24 +0000
3+++ debian/changelog 2018-04-18 16:01:42 +0000
4@@ -1,3 +1,11 @@
5+update-notifier (3.191) UNRELEASED; urgency=medium
6+
7+ * src/update-notifier.h: Add LIVEPATCH_FILE and livepatch_pending.
8+ * src/update-notifier.c: Monitor the livepatch status file too
9+ and show notification if needed (LP: #1761841).
10+
11+ -- Andrea Azzarone <andrea.azzarone@canonical.com> Wed, 18 Apr 2018 17:54:10 +0200
12+
13 update-notifier (3.190) bionic; urgency=medium
14
15 * Add missing build-dependency on dh-python
16
17=== modified file 'src/update-notifier.c'
18--- src/update-notifier.c 2017-09-06 09:31:58 +0000
19+++ src/update-notifier.c 2018-04-18 16:01:42 +0000
20@@ -189,6 +189,14 @@
21 g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, NULL);
22 }
23
24+void livepatch_check()
25+{
26+ g_debug("livepatch_check ()");
27+ gchar *argv[2];
28+ argv[0] = "/usr/lib/update-notifier/livepatch-notification";
29+ argv[1] = NULL;
30+ g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, NULL);
31+}
32
33 static gboolean
34 trayapplet_create (TrayApplet *ta, UpgradeNotifier *un, char *name)
35@@ -257,6 +265,10 @@
36 g_debug_inotify("avahi disabled due to unicast .local domain");
37 un->unicast_local_avahi_pending = TRUE;
38 }
39+ if(strstr(info_uri, LIVEPATCH_FILE)) {
40+ g_debug_inotify("livepatch status changed");
41+ un->livepatch_pending = TRUE;
42+ }
43 }
44
45 /*
46@@ -268,6 +280,7 @@
47 * - hook_pending: we have new upgrade hook information
48 * - crashreport_pending: we have a new crashreport
49 * - unicast_local_avahi_pending: avahi got disabled due to a unicast .local domain
50+ * - livepatch_pending: livepatch status changed
51 *
52 */
53 static gboolean
54@@ -352,6 +365,12 @@
55 un->unicast_local_avahi_pending = FALSE;
56 }
57
58+ if(un->livepatch_pending) {
59+ g_debug("checking for livepatch status now");
60+ livepatch_check ();
61+ un->livepatch_pending = FALSE;
62+ }
63+
64 // reset the bitfields (for the next "time-slice")
65 un->dpkg_was_run = FALSE;
66 un->apt_get_running = FALSE;
67@@ -395,6 +414,7 @@
68 "/var/lib/update-notifier/dpkg-run-stamp",
69 "/var/lib/apt/periodic/update-success-stamp",
70 UNICAST_LOCAL_AVAHI_FILE,
71+ LIVEPATCH_FILE,
72 NULL};
73 for(i=0;monitor_files[i] != NULL;i++) {
74 if (getenv("UPSTART_SESSION") && monitor_files[i] == UNICAST_LOCAL_AVAHI_FILE) {
75
76=== modified file 'src/update-notifier.h'
77--- src/update-notifier.h 2016-07-20 17:23:40 +0000
78+++ src/update-notifier.h 2018-04-18 16:01:42 +0000
79@@ -45,6 +45,7 @@
80 #define CRASHREPORT_REPORT_APP "/usr/share/apport/apport-gtk"
81 #define CRASHREPORT_DIR "/var/crash/"
82 #define UNICAST_LOCAL_AVAHI_FILE "/run/avahi-daemon/disabled-for-unicast-local"
83+#define LIVEPATCH_FILE "/var/snap/canonical-livepatch/current/status"
84
85 // security update autolaunch minimal time (12h)
86 #define AUTOLAUNCH_MINIMAL_SECURITY_INTERVAL 12*60*60
87@@ -105,6 +106,7 @@
88 gboolean hook_pending;
89 gboolean crashreport_pending;
90 gboolean unicast_local_avahi_pending;
91+ gboolean livepatch_pending;
92 time_t last_apt_action;
93
94 };

Subscribers

People subscribed via source and target branches

to all changes: