Merge lp:~xnox/hw-detect/fix-firmware-order into lp:~ubuntu-core-dev/hw-detect/ubuntu

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1488
Proposed branch: lp:~xnox/hw-detect/fix-firmware-order
Merge into: lp:~ubuntu-core-dev/hw-detect/ubuntu
Diff against target: 112 lines (+36/-23)
5 files modified
debian/changelog (+11/-0)
debian/control (+0/-1)
driver-injection-disk.sh (+1/-1)
hw-detect.post-base-installer.d/50install-firmware (+3/-21)
hw-detect.pre-pkgsel.d/50install-firmware (+21/-0)
To merge this branch: bzr merge lp:~xnox/hw-detect/fix-firmware-order
Reviewer Review Type Date Requested Status
Adam Conrad (community) Approve
Ubuntu Installer Team Pending
Colin Watson Pending
Review via email: mp+181886@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Adam Conrad (adconrad) wrote :

50-install-firmware is possibly the scariest thing I've read all week, but +1 to the change in this MP for shuffling it around in the installation process.

Revision history for this message
Adam Conrad (adconrad) wrote :

I take it back, after thinking about it a bit. Random chatter from IRC:

12:20 < infinity> xnox: Hrm, after I've approved it, I now wonder if the above scary bit is a
                  problem with reordering.
12:20 < infinity> xnox: Since it could be overwriting firmware from linux-firmware (presumably, it
                  ran before linux-firmware was installed before you moved it)
12:21 < infinity> Honestly, I wonder who thought that was a good idea AT ALL. Copying random
                  firmware from the installer to the target system just seems scary.
12:26 < superm1> 50-install-firmware wasn't written as part of the driver injection disk stuff, i
                 thought that part came from debian from earlier
12:26 < infinity> Indeed, you just leveraged it, since it already copies debs around and installs
                  them.
12:26 < infinity> In fact...
12:26 < infinity> Hrm.
12:27 < infinity> xnox: It might be better to put 50-install-firmware back where it came from.
12:27 < infinity> xnox: And do a new XX-driver-disk in hw-detect.pre-pkgsel.d that uses a different
                  /tmp directory.
12:28 < infinity> xnox: And mangle driver-injection-disk.sh to use that instead of overloading
                  /tmp/firmware

Revision history for this message
Colin Watson (cjwatson) wrote :

There's another ordering problem with moving these, although technically it's probably only a problem when merging the change back to Debian: the apt-setup/non-free handling needs to come before apt-setup runs, and pre-pkgsel.d is too late for that.

For now we should keep the handling of loose firmware files, although I agree that it has some obvious problems such as not distinguishing those that were inserted manually from those that are in linux-firmware. We don't need to rearrange this to fix the bug at hand.

My suggestion would be:

 * strip out the parts of hw-detect.post-base-installer.d/50install-firmware that actually install the .debs, but keep the handling of loose firmware files and of apt-setup/non-free (in other words, if there's anything in /var/cache/firmware/*.deb that passes [ -f ], set apt-setup/non-free to true)
 * create a new hw-detect/pre-pkgsel.d/50install-firmware and move the parts of the previous code that actually install the .debs there

1486. By Dimitri John Ledkov

catch up from trunk

1487. By Dimitri John Ledkov

revert initial implementation

1488. By Dimitri John Ledkov

* Make driver-injection-disk use a directory which is different from the
  one firmware injection uses.
* Move driver-injection-disk debs installation to pre-pkgsel.d stage,
  such that it is after the kernel has been installed. In cases injected
  driver .debs depend on particular kernel packages.

1489. By Dimitri John Ledkov

Enable nonfree repositories in install-firmware, if there are injected
drivers to install later.

1490. By Dimitri John Ledkov

Move firmware/injected drivers' .deb packages installation from
post-base-installer.d stage to pre-pkgsel.d stage.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Following a discussion with Colin on IRC, I agree with implementation outline in his comment above.
Branch updated.

1491. By Dimitri John Ledkov

Bump question to load driver injection disk from medium to high, and
raise driver-injection-disk package priority to standard. Thus the
udeb will be loaded by default, but before installing any debs from
the OEMDRM a confirmation question will be asked (default true, can be
pre-seeded)

Revision history for this message
Adam Conrad (adconrad) wrote :

This looks much saner now, except for the s/OEMDRV/OEMDRM/ typo in your changelog. I'm happy with it.

Revision history for this message
Adam Conrad (adconrad) :
review: Approve
Revision history for this message
Adam Conrad (adconrad) wrote :

Oh, and please close the relevant bug in your changelog too.

1492. By Dimitri John Ledkov

OEMDRV typo

1493. By Dimitri John Ledkov

Add bug #

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-09-05 14:06:58 +0000
3+++ debian/changelog 2013-09-20 15:34:57 +0000
4@@ -1,5 +1,6 @@
5 hw-detect (1.95ubuntu1) UNRELEASED; urgency=low
6
7+ [ Colin Watson ]
8 * Resynchronise with Debian. Remaining changes:
9 - Remove FireWire Ethernet support.
10 - Register lp module on i386 and amd64.
11@@ -30,6 +31,16 @@
12 * Drop changes for PS3 and Cell, since we haven't been able to support
13 these platforms for some time.
14
15+ [ Dmitrijs Ledkovs ]
16+ * Move firmware/injected drivers' .deb packages installation from
17+ post-base-installer.d stage to pre-pkgsel.d stage. (LP: #1209287, LP:
18+ #1216043)
19+ * Bump question to load driver injection disk from medium to high, and
20+ raise driver-injection-disk package priority to standard. Thus the
21+ udeb will be loaded by default, but before installing any debs from
22+ the OEMDRV a confirmation question will be asked (default true, can be
23+ pre-seeded)
24+
25 -- Colin Watson <cjwatson@ubuntu.com> Thu, 05 Sep 2013 15:01:17 +0100
26
27 hw-detect (1.95) unstable; urgency=low
28
29=== modified file 'debian/control'
30--- debian/control 2013-09-05 14:02:44 +0000
31+++ debian/control 2013-09-20 15:34:57 +0000
32@@ -38,7 +38,6 @@
33 Package-Type: udeb
34 Architecture: all
35 Depends: cdebconf-udeb (>= 0.38), hw-detect, mountmedia
36-Priority: optional
37 Enhances: hw-detect
38 XB-Installer-Menu-Item: 1500
39 Description: Detect OEM driver injection disks
40
41=== modified file 'driver-injection-disk.sh' (properties changed: -x to +x)
42--- driver-injection-disk.sh 2011-03-12 17:49:47 +0000
43+++ driver-injection-disk.sh 2013-09-20 15:34:57 +0000
44@@ -32,7 +32,7 @@
45 for device in $(list-devices usb-partition); do
46 label=$(block-attr --label $device 2>/dev/null || true)
47 if [ "$label" = "OEMDRV" ]; then
48- db_input medium driver-injection-disk/load || true
49+ db_input high driver-injection-disk/load || true
50 if ! db_go; then
51 exit 10 # back up
52 fi
53
54=== modified file 'hw-detect.post-base-installer.d/50install-firmware'
55--- hw-detect.post-base-installer.d/50install-firmware 2010-03-09 19:17:16 +0000
56+++ hw-detect.post-base-installer.d/50install-firmware 2013-09-20 15:34:57 +0000
57@@ -12,26 +12,8 @@
58 done
59 fi
60
61-deb_package () {
62- ar p "$1" control.tar.gz | tar zxO ./control | grep 'Package:' | sed -e 's/Package: *//'
63-}
64-
65-# install cached firmware debs
66-if [ -d /var/cache/firmware ]; then
67- for deb in /var/cache/firmware/*.deb; do
68- if [ -f "$deb" ]; then
69- cp -a "$deb" /target/tmp
70- # TODO debconf passthrough
71- if ! in-target dpkg -i "/tmp/$(basename "$deb")"; then
72- # dpkg failed, force removal of package
73- in-target dpkg --force-depends --remove "$(deb_package "$deb")" || true
74- fi
75- rm -f "/target/tmp/$deb"
76- need_nonfree=1
77- fi
78- done
79-fi
80-
81-if [ "$need_nonfree" ]; then
82+# enable non-free repository if any firmware / injected drivers are
83+# detected.
84+if [ -n "/var/cache/firmware/*.deb" ]; then
85 db_set apt-setup/non-free true
86 fi
87
88=== added file 'hw-detect.pre-pkgsel.d/50install-firmware'
89--- hw-detect.pre-pkgsel.d/50install-firmware 1970-01-01 00:00:00 +0000
90+++ hw-detect.pre-pkgsel.d/50install-firmware 2013-09-20 15:34:57 +0000
91@@ -0,0 +1,21 @@
92+#!/bin/sh
93+set -e
94+
95+deb_package () {
96+ ar p "$1" control.tar.gz | tar zxO ./control | grep 'Package:' | sed -e 's/Package: *//'
97+}
98+
99+# install cached firmware debs
100+if [ -d /var/cache/firmware ]; then
101+ for deb in /var/cache/firmware/*.deb; do
102+ if [ -f "$deb" ]; then
103+ cp -a "$deb" /target/tmp
104+ # TODO debconf passthrough
105+ if ! in-target dpkg -i "/tmp/$(basename "$deb")"; then
106+ # dpkg failed, force removal of package
107+ in-target dpkg --force-depends --remove "$(deb_package "$deb")" || true
108+ fi
109+ rm -f "/target/tmp/$deb"
110+ fi
111+ done
112+fi

Subscribers

People subscribed via source and target branches

to all changes: