Merge lp:~oem-solutions-group/usb-creator/support-oem-images into lp:usb-creator

Proposed by Cody A.W. Somerville
Status: Merged
Merged at revision: not available
Proposed branch: lp:~oem-solutions-group/usb-creator/support-oem-images
Merge into: lp:usb-creator
Diff against target: 96 lines
2 files modified
debian/changelog (+11/-2)
usbcreator/install.py (+20/-28)
To merge this branch: bzr merge lp:~oem-solutions-group/usb-creator/support-oem-images
Reviewer Review Type Date Requested Status
Evan Pending
Review via email: mp+12721@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Cody A.W. Somerville (cody-somerville) wrote :

This branch should make usb-creator work with images created by the OEM Image Build System. Not that OEM images are overly alien or anything though, we just simply organize our syslinux configuration files differently. We can get around this by instead of only looking at a set of hardcoded file names look at all the cfg files under the syslinux directory.

This branch also removes the copy of '/syslinux/syslinux.cfg' to '/syslinux.cfg'. I'm pretty sure this is no longer necessary but I'm actually going to build an image and test this right now to double check.

230. By Cody A.W. Somerville

Strip tabs when parsing iso/syslinx config files to correctly identify
commands in a syslinux config file that indents lines.

231. By Cody A.W. Somerville

Don't (incorrectly) assume cwd when globbing for syslinux config files.

232. By Cody A.W. Somerville

Simplify mangle_syslinux function by removing need to calculate element indexes by appending instead of inserting new boot arguments in the middle of the list. Also, ensure command is always set to the command for the current line (even though the original motiviation, protecting against ValueError x not in list exceptions being thrown when getting index of command in list, is moot now.

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 2009-10-01 13:30:00 +0000
3+++ debian/changelog 2009-10-01 17:00:29 +0000
4@@ -1,9 +1,18 @@
5 usb-creator (0.2.9) UNRELEASED; urgency=low
6-
7+
8+ [Evan Dandrea]
9 * Properly catch exceptions around modifying the syslinux
10 configuration (LP: #439977).
11+
12+ [Cody A.W. Somerville]
13+ * usbcreator/install.py:
14+ - Do not copy /syslinux/syslinux.cfg to root of disk, no longer needed.
15+ - Look at all files ending in .cfg under the syslinux directory when
16+ updating configuration files based on the options selected in usb-creator.
17+ - Strip tabs when parsing iso/syslinx config files to correctly identify
18+ commands in a syslinux config file that indents lines.
19
20- -- Evan Dandrea <evand@ubuntu.com> Thu, 01 Oct 2009 14:29:35 +0100
21+ -- Cody A.W. Somerville <cody.somerville@canonical.com> Thu, 01 Oct 2009 11:24:14 -0300
22
23 usb-creator (0.2.8) karmic; urgency=low
24
25
26=== modified file 'usbcreator/install.py'
27--- usbcreator/install.py 2009-10-01 13:30:00 +0000
28+++ usbcreator/install.py 2009-10-01 17:00:29 +0000
29@@ -223,34 +223,32 @@
30 os.path.join(self.target, 'syslinux', 'syslinux.cfg'))
31 self.check()
32
33- # Mangle the configuration file based on the options we've selected.
34- for filename in (os.path.join('syslinux', 'syslinux.cfg'),
35- os.path.join('syslinux', 'adtext.cfg'),
36- os.path.join('syslinux', 'text.cfg')):
37+ # Mangle the configuration files based on the options we've selected.
38+ import glob
39+ for filename in glob.iglob("%s/syslinux/*.cfg" % self.target):
40 f = None
41 try:
42- f = open(os.path.join(self.target, filename), 'r')
43+ f = open(filename, 'r')
44 label = ''
45 to_write = []
46 for line in f.readlines():
47- line = line.strip('\n').split(' ')
48- for l in line:
49- if l:
50- command = l
51- break
52- if command.lower() == 'append':
53- pos = line.index(command) + 2
54- if label not in ('check', 'memtest', 'hd'):
55- if self.persist != 0:
56- line.insert(pos, 'persistent')
57- line.insert(pos, 'cdrom-detect/try-usb=true')
58- if label not in ('memtest', 'hd'):
59- line.insert(pos, 'noprompt')
60- elif command.lower() == 'label':
61- label = line[1].strip()
62- to_write.append(' '.join(line) + '\n')
63+ line = line.strip('\n\t').split(' ')
64+ if len(line) and len(line[0]):
65+ command = line[0]
66+ if command.lower() == 'label':
67+ label = line[1].strip()
68+ elif command.lower() == 'append':
69+ if label not in ('check', 'memtest', 'hd'):
70+ if self.persist != 0:
71+ line.append('persistent')
72+ line.append('cdrom-detect/try-usb=true')
73+ if label not in ('memtest', 'hd'):
74+ line.append('noprompt')
75+ to_write.append(' '.join(line) + '\n')
76+ else:
77+ pass
78 f.close()
79- f = open(os.path.join(self.target, filename), 'w')
80+ f = open(filename, 'w')
81 f.writelines(to_write)
82 except (KeyboardInterrupt, SystemExit):
83 raise
84@@ -262,12 +260,6 @@
85 if f:
86 f.close()
87 self.check()
88-
89- # TODO evand 2009-07-23: Test whether present versions of syslinux
90- # still require syslinux.cfg at the root of the filesystem. This was
91- # supposed to have been fixed.
92- shutil.copy2(os.path.join(self.target, 'syslinux', 'syslinux.cfg'),
93- os.path.join(self.target, 'syslinux.cfg'))
94
95 def create_persistence(self):
96 logging.debug('create_persistence')

Subscribers

People subscribed via source and target branches