Merge ~mwhudson/ubiquity:lp-1847898 into ubiquity:master

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 50fc6e0f9afbdfddafb2f616972dc6887d5adbc8
Proposed branch: ~mwhudson/ubiquity:lp-1847898
Merge into: ubiquity:master
Diff against target: 29 lines (+13/-1)
1 file modified
ubiquity/misc.py (+13/-1)
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Review via email: mp+383762@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I haven't tested this yet.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I have now tested this and it worked for me.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ubiquity/misc.py b/ubiquity/misc.py
2index c0b0536..ad40a49 100644
3--- a/ubiquity/misc.py
4+++ b/ubiquity/misc.py
5@@ -371,11 +371,23 @@ def grub_default(boot=None):
6
7 devices = grub_device_map()
8 target = None
9- if devices:
10+
11+ if boot is not None:
12+ for device in devices:
13+ try:
14+ candidate = os.path.realpath(device.split('\t')[1])
15+ except (IndexError, OSError):
16+ pass
17+ if candidate == boot:
18+ target = candidate
19+ break
20+
21+ if target is None and devices:
22 try:
23 target = os.path.realpath(devices[0].split('\t')[1])
24 except (IndexError, OSError):
25 pass
26+
27 # last resort
28 if target is None:
29 target = '(hd0)'

Subscribers

People subscribed via source and target branches