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
=== modified file 'debian/changelog'
--- debian/changelog 2018-04-09 11:35:24 +0000
+++ debian/changelog 2018-04-18 16:01:42 +0000
@@ -1,3 +1,11 @@
1update-notifier (3.191) UNRELEASED; urgency=medium
2
3 * src/update-notifier.h: Add LIVEPATCH_FILE and livepatch_pending.
4 * src/update-notifier.c: Monitor the livepatch status file too
5 and show notification if needed (LP: #1761841).
6
7 -- Andrea Azzarone <andrea.azzarone@canonical.com> Wed, 18 Apr 2018 17:54:10 +0200
8
1update-notifier (3.190) bionic; urgency=medium9update-notifier (3.190) bionic; urgency=medium
210
3 * Add missing build-dependency on dh-python11 * Add missing build-dependency on dh-python
412
=== modified file 'src/update-notifier.c'
--- src/update-notifier.c 2017-09-06 09:31:58 +0000
+++ src/update-notifier.c 2018-04-18 16:01:42 +0000
@@ -189,6 +189,14 @@
189 g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, NULL);189 g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, NULL);
190}190}
191191
192void livepatch_check()
193{
194 g_debug("livepatch_check ()");
195 gchar *argv[2];
196 argv[0] = "/usr/lib/update-notifier/livepatch-notification";
197 argv[1] = NULL;
198 g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, NULL);
199}
192200
193static gboolean201static gboolean
194trayapplet_create (TrayApplet *ta, UpgradeNotifier *un, char *name)202trayapplet_create (TrayApplet *ta, UpgradeNotifier *un, char *name)
@@ -257,6 +265,10 @@
257 g_debug_inotify("avahi disabled due to unicast .local domain");265 g_debug_inotify("avahi disabled due to unicast .local domain");
258 un->unicast_local_avahi_pending = TRUE;266 un->unicast_local_avahi_pending = TRUE;
259 }267 }
268 if(strstr(info_uri, LIVEPATCH_FILE)) {
269 g_debug_inotify("livepatch status changed");
270 un->livepatch_pending = TRUE;
271 }
260}272}
261273
262/*274/*
@@ -268,6 +280,7 @@
268 * - hook_pending: we have new upgrade hook information280 * - hook_pending: we have new upgrade hook information
269 * - crashreport_pending: we have a new crashreport281 * - crashreport_pending: we have a new crashreport
270 * - unicast_local_avahi_pending: avahi got disabled due to a unicast .local domain282 * - unicast_local_avahi_pending: avahi got disabled due to a unicast .local domain
283 * - livepatch_pending: livepatch status changed
271 *284 *
272 */285 */
273static gboolean286static gboolean
@@ -352,6 +365,12 @@
352 un->unicast_local_avahi_pending = FALSE;365 un->unicast_local_avahi_pending = FALSE;
353 }366 }
354367
368 if(un->livepatch_pending) {
369 g_debug("checking for livepatch status now");
370 livepatch_check ();
371 un->livepatch_pending = FALSE;
372 }
373
355 // reset the bitfields (for the next "time-slice")374 // reset the bitfields (for the next "time-slice")
356 un->dpkg_was_run = FALSE;375 un->dpkg_was_run = FALSE;
357 un->apt_get_running = FALSE;376 un->apt_get_running = FALSE;
@@ -395,6 +414,7 @@
395 "/var/lib/update-notifier/dpkg-run-stamp",414 "/var/lib/update-notifier/dpkg-run-stamp",
396 "/var/lib/apt/periodic/update-success-stamp",415 "/var/lib/apt/periodic/update-success-stamp",
397 UNICAST_LOCAL_AVAHI_FILE,416 UNICAST_LOCAL_AVAHI_FILE,
417 LIVEPATCH_FILE,
398 NULL};418 NULL};
399 for(i=0;monitor_files[i] != NULL;i++) {419 for(i=0;monitor_files[i] != NULL;i++) {
400 if (getenv("UPSTART_SESSION") && monitor_files[i] == UNICAST_LOCAL_AVAHI_FILE) {420 if (getenv("UPSTART_SESSION") && monitor_files[i] == UNICAST_LOCAL_AVAHI_FILE) {
401421
=== modified file 'src/update-notifier.h'
--- src/update-notifier.h 2016-07-20 17:23:40 +0000
+++ src/update-notifier.h 2018-04-18 16:01:42 +0000
@@ -45,6 +45,7 @@
45#define CRASHREPORT_REPORT_APP "/usr/share/apport/apport-gtk"45#define CRASHREPORT_REPORT_APP "/usr/share/apport/apport-gtk"
46#define CRASHREPORT_DIR "/var/crash/"46#define CRASHREPORT_DIR "/var/crash/"
47#define UNICAST_LOCAL_AVAHI_FILE "/run/avahi-daemon/disabled-for-unicast-local"47#define UNICAST_LOCAL_AVAHI_FILE "/run/avahi-daemon/disabled-for-unicast-local"
48#define LIVEPATCH_FILE "/var/snap/canonical-livepatch/current/status"
4849
49// security update autolaunch minimal time (12h)50// security update autolaunch minimal time (12h)
50#define AUTOLAUNCH_MINIMAL_SECURITY_INTERVAL 12*60*6051#define AUTOLAUNCH_MINIMAL_SECURITY_INTERVAL 12*60*60
@@ -105,6 +106,7 @@
105 gboolean hook_pending;106 gboolean hook_pending;
106 gboolean crashreport_pending;107 gboolean crashreport_pending;
107 gboolean unicast_local_avahi_pending;108 gboolean unicast_local_avahi_pending;
109 gboolean livepatch_pending;
108 time_t last_apt_action;110 time_t last_apt_action;
109111
110};112};

Subscribers

People subscribed via source and target branches

to all changes: