Merge lp:~jamesodhunt/ubuntu/raring/json-c/restart-upstart into lp:ubuntu/raring/json-c

Proposed by James Hunt
Status: Merged
Merged at revision: 14
Proposed branch: lp:~jamesodhunt/ubuntu/raring/json-c/restart-upstart
Merge into: lp:ubuntu/raring/json-c
Diff against target: 72 lines (+60/-0)
2 files modified
debian/changelog (+7/-0)
debian/postinst (+53/-0)
To merge this branch: bzr merge lp:~jamesodhunt/ubuntu/raring/json-c/restart-upstart
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Ubuntu branches Pending
Review via email: mp+146868@code.launchpad.net

Description of the change

Restart upstart when libjson0 is upgraded (using the same logic as the upstart
package itself uses to restart PID 1).

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Looks good to me. I like verbose comments =)

review: Approve

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 2013-01-20 04:21:12 +0000
3+++ debian/changelog 2013-02-06 14:33:20 +0000
4@@ -1,3 +1,10 @@
5+json-c (0.10-1.2ubuntu2) UNRELEASED; urgency=low
6+
7+ * debian/postinst: Force an upgrade to restart Upstart (to pick up
8+ new package version) if the running instance supports it.
9+
10+ -- James Hunt <james.hunt@ubuntu.com> Wed, 06 Feb 2013 14:12:05 +0000
11+
12 json-c (0.10-1.2ubuntu1) raring; urgency=low
13
14 * Add autoreconf to update config.sub,guess for aarch64 (LP: #1102043)
15
16=== added file 'debian/postinst'
17--- debian/postinst 1970-01-01 00:00:00 +0000
18+++ debian/postinst 2013-02-06 14:33:20 +0000
19@@ -0,0 +1,53 @@
20+#!/bin/sh
21+
22+set -e
23+
24+if [ "$1" = configure ]; then
25+ # A dependent library of Upstart has changed, so restart Upstart
26+ # such that it can safely unmount the root filesystem (LP: #740390)
27+
28+ # Query running version of Upstart, but only when we know
29+ # that initctl will work.
30+ #
31+ # The calculated version string may be the null string if
32+ # Upstart is not running (where for example an alternative
33+ # init is running outside a chroot environment) or if the
34+ # query failed for some reason. However, the version check
35+ # below handles a null version string correctly.
36+ UPSTART_VERSION_RUNNING=$(initctl version 2>/dev/null |\
37+ awk '{print $3}'|tr -d ')' || :)
38+
39+ if ischroot; then
40+ # Do not honour re-exec when requested from within a
41+ # chroot since:
42+ #
43+ # (a) The version of Upstart outside might not support it.
44+ # (b) An isolated environment such as a chroot should
45+ # not be able to modify its containing environment.
46+ #
47+ # A sufficiently new Upstart will actually handle a re-exec
48+ # request coming from telinit within a chroot correctly (by
49+ # doing nothing) but it's simple enough to perform the check
50+ # here and save Upstart the effort.
51+ :
52+ elif dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 1.6.1; then
53+ # We are not running inside a chroot and the running version
54+ # of Upstart supports stateful re-exec, so we can
55+ # restart immediately.
56+ #
57+ # XXX: Note that the check on the running version must
58+ # remain *indefinitely* since it's the only safe way to
59+ # know if stateful re-exec is supported: simply checking
60+ # packaged version numbers is not sufficient since
61+ # the package could be upgraded multiple times without a
62+ # reboot.
63+ telinit u || :
64+ else
65+ # Before we shutdown or reboot, we need to re-exec so that we
66+ # can safely remount the root filesystem; we can't just do that
67+ # here because we lose state.
68+ touch /var/run/init.upgraded || :
69+ fi
70+fi
71+
72+#DEBHELPER#

Subscribers

People subscribed via source and target branches

to all changes: