Merge lp:~broder/ubuntu/precise/bluez/bluez-respawn into lp:ubuntu/precise/bluez

Proposed by Evan Broder
Status: Merged
Merged at revision: 88
Proposed branch: lp:~broder/ubuntu/precise/bluez/bluez-respawn
Merge into: lp:ubuntu/precise/bluez
Diff against target: 190 lines (+109/-29)
7 files modified
debian/bluez.bluetooth.default (+0/-20)
debian/bluez.bluetooth.upstart (+1/-9)
debian/bluez.maintscript (+1/-0)
debian/bluez.postrm (+49/-0)
debian/bluez.preinst (+45/-0)
debian/changelog (+12/-0)
debian/control (+1/-0)
To merge this branch: bzr merge lp:~broder/ubuntu/precise/bluez/bluez-respawn
Reviewer Review Type Date Requested Status
Ubuntu Sponsors Pending
Review via email: mp+95979@code.launchpad.net

Description of the change

Eliminate the /etc/default/bluetooth conffile - Upstart shouldn't be using /etc/default files just to enable/disable a job.

To smooth out the transition, if bluez has been disabled using /etc/default/bluetooth, migrate that setting to an Upstart override file.

I can upload this change myself, but I'd like a second pair of eyes to make sure I handled the fiddlier parts of the maintainer scripts correctly.

To post a comment you must log in.
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

looks good, though I'm used to doing the version comparison against the new version and not the 'latest broken one'

Revision history for this message
Evan Broder (broder) wrote :

Thanks for the feedback, Timo. I agree - it's not how I usually write those comparisons either, but it's what dpkg-maintscript-helper does, so I wanted to be consistent between my code and the autogenerated stuff.

I'll go ahead and upload this, then.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'debian/bluez.bluetooth.default'
2--- debian/bluez.bluetooth.default 2009-06-30 20:05:13 +0000
3+++ debian/bluez.bluetooth.default 1970-01-01 00:00:00 +0000
4@@ -1,20 +0,0 @@
5-# Defaults for bluez
6-
7-# start bluetooth on boot?
8-# compatibility note: if this variable is _not_ found bluetooth will start
9-BLUETOOTH_ENABLED=1
10-
11-# This setting used to switch HID devices (e.g mouse/keyboad) to HCI mode, that
12-# is you will have bluetooth functionality from your dongle instead of only
13-# HID. This is accomplished for supported devices by udev in
14-# /lib/udev/rules.d/62-bluez-hid2hci.rules by invoking hid2hci with correct
15-# parameters.
16-# See /usr/share/doc/bluez/NEWS.Debian.gz for further information.
17-
18-# Older daemons like pand dund and hidd can be found in bluez-compat package as
19-# they are deprecated and provided for backward compatibility only.
20-
21-# Note that not every bluetooth dongle is capable of switching back to HID mode,
22-# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=355497
23-HID2HCI_ENABLED=0
24-HID2HCI_UNDO=0
25
26=== modified file 'debian/bluez.bluetooth.upstart'
27--- debian/bluez.bluetooth.upstart 2012-01-24 11:31:04 +0000
28+++ debian/bluez.bluetooth.upstart 2012-03-05 19:44:31 +0000
29@@ -9,18 +9,10 @@
30 env RFCOMM_CONF=/etc/bluetooth/rfcomm.conf
31
32 expect fork
33+respawn
34
35 exec /usr/sbin/bluetoothd
36
37-pre-start script
38- test -f /etc/default/bluetooth && . /etc/default/bluetooth || :
39-
40- if [ "$BLUETOOTH_ENABLED" = "0" ];
41- then
42- exit 1
43- fi
44-end script
45-
46 post-start script
47 [ "$VERBOSE" = no ] && redirect='>/dev/null 2>&1' || redirect=
48
49
50=== added file 'debian/bluez.maintscript'
51--- debian/bluez.maintscript 1970-01-01 00:00:00 +0000
52+++ debian/bluez.maintscript 2012-03-05 19:44:31 +0000
53@@ -0,0 +1,1 @@
54+rm_conffile /etc/default/bluetooth 4.98-2ubuntu1
55
56=== added file 'debian/bluez.postrm'
57--- debian/bluez.postrm 1970-01-01 00:00:00 +0000
58+++ debian/bluez.postrm 2012-03-05 19:44:31 +0000
59@@ -0,0 +1,49 @@
60+#!/bin/sh
61+# postrm script for bluez
62+#
63+# see: dh_installdeb(1)
64+
65+set -e
66+
67+# summary of how this script can be called:
68+# * <postrm> `remove'
69+# * <postrm> `purge'
70+# * <old-postrm> `upgrade' <new-version>
71+# * <new-postrm> `failed-upgrade' <old-version>
72+# * <new-postrm> `abort-install'
73+# * <new-postrm> `abort-install' <old-version>
74+# * <new-postrm> `abort-upgrade' <old-version>
75+# * <disappearer's-postrm> `disappear' <overwriter>
76+# <overwriter-version>
77+# for details, see http://www.debian.org/doc/debian-policy/ or
78+# the debian-policy package
79+
80+
81+case "$1" in
82+ remove|upgrade|failed-upgrade|disappear)
83+ ;;
84+
85+ purge)
86+ if [ "$(cat /etc/init/bluetooth.override)" = "$(printf "# Inserted by bluez\nmanual\n")" ]; then
87+ rm -f /etc/init/bluetooth.override
88+ fi
89+ ;;
90+
91+ abort-install|abort-upgrade)
92+ if dpkg --compare-versions "$2" le-nl 4.98-2ubuntu1; then
93+ perl -i -0pe 's/# Inserted by bluez\nmanual\n//' /etc/init/bluetooth.override
94+ fi
95+ ;;
96+
97+ *)
98+ echo "postrm called with unknown argument \`$1'" >&2
99+ exit 1
100+ ;;
101+esac
102+
103+# dh_installdeb will replace this with shell code automatically
104+# generated by other debhelper scripts.
105+
106+#DEBHELPER#
107+
108+exit 0
109
110=== added file 'debian/bluez.preinst'
111--- debian/bluez.preinst 1970-01-01 00:00:00 +0000
112+++ debian/bluez.preinst 2012-03-05 19:44:31 +0000
113@@ -0,0 +1,45 @@
114+#!/bin/sh
115+# preinst script for bluez
116+#
117+# see: dh_installdeb(1)
118+
119+set -e
120+
121+# summary of how this script can be called:
122+# * <new-preinst> `install'
123+# * <new-preinst> `install' <old-version>
124+# * <new-preinst> `upgrade' <old-version>
125+# * <old-preinst> `abort-upgrade' <new-version>
126+# for details, see http://www.debian.org/doc/debian-policy/ or
127+# the debian-policy package
128+
129+
130+case "$1" in
131+ install|upgrade)
132+ if dpkg --compare-versions "$2" le-nl 4.98-2ubuntu1; then
133+ (
134+ test -f /etc/default/bluetooth && . /etc/default/bluetooth
135+ if [ "$BLUETOOTH_ENABLED" = 0 ] &&
136+ (! [ -f /etc/init/bluetooth.override ] ||
137+ ! grep -q -e "start on" -e "manual" /etc/init/bluetooth.override); then
138+ printf "# Inserted by bluez\nmanual\n" >> /etc/init/bluetooth.override
139+ fi
140+ )
141+ fi
142+ ;;
143+
144+ abort-upgrade)
145+ ;;
146+
147+ *)
148+ echo "preinst called with unknown argument \`$1'" >&2
149+ exit 1
150+ ;;
151+esac
152+
153+# dh_installdeb will replace this with shell code automatically
154+# generated by other debhelper scripts.
155+
156+#DEBHELPER#
157+
158+exit 0
159
160=== modified file 'debian/changelog'
161--- debian/changelog 2012-02-22 10:51:07 +0000
162+++ debian/changelog 2012-03-05 19:44:31 +0000
163@@ -1,3 +1,15 @@
164+bluez (4.98-2ubuntu2) precise; urgency=low
165+
166+ [ Pali Rohár ]
167+ * Respawn bluetooth daemon if crashed.
168+
169+ [ Evan Broder ]
170+ * Eliminate the /etc/default/bluetooth conffile as it's not the Upstart
171+ way. Transition the BLUETOOTH_ENABLED variable to an Upstart override
172+ variable if it's been changed.
173+
174+ -- Evan Broder <evan@ebroder.net> Sat, 03 Mar 2012 18:48:55 -0800
175+
176 bluez (4.98-2ubuntu1) precise; urgency=low
177
178 * Merge with Debian unstable. Remaining Ubuntu changes:
179
180=== modified file 'debian/control'
181--- debian/control 2012-02-22 10:51:07 +0000
182+++ debian/control 2012-03-05 19:44:31 +0000
183@@ -72,6 +72,7 @@
184
185 Package: bluez
186 Architecture: amd64 armel i386 ia64 mips mipsel powerpc s390 s390x sparc alpha armhf avr32 hppa m68k powerpcspe sh4 sparc64 ppc64
187+Pre-Depends: ${misc:Pre-Depends}
188 Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, module-init-tools, udev (>= 170-1), lsb-base, dbus, python-gobject, python-dbus
189 Replaces: bluez-input, bluez-network, bluez-serial, bluez-utils (<= 3.36-3), bluez-audio (<= 3.36-3), udev (<< 170-1)
190 Conflicts: bluez-utils (<= 3.36-3), bluez-audio (<= 3.36-3)

Subscribers

People subscribed via source and target branches

to all changes: