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
=== modified file 'debian/changelog'
--- debian/changelog 2009-10-01 13:30:00 +0000
+++ debian/changelog 2009-10-01 17:00:29 +0000
@@ -1,9 +1,18 @@
1usb-creator (0.2.9) UNRELEASED; urgency=low1usb-creator (0.2.9) UNRELEASED; urgency=low
22
3 [Evan Dandrea]
3 * Properly catch exceptions around modifying the syslinux4 * Properly catch exceptions around modifying the syslinux
4 configuration (LP: #439977).5 configuration (LP: #439977).
6
7 [Cody A.W. Somerville]
8 * usbcreator/install.py:
9 - Do not copy /syslinux/syslinux.cfg to root of disk, no longer needed.
10 - Look at all files ending in .cfg under the syslinux directory when
11 updating configuration files based on the options selected in usb-creator.
12 - Strip tabs when parsing iso/syslinx config files to correctly identify
13 commands in a syslinux config file that indents lines.
514
6 -- Evan Dandrea <evand@ubuntu.com> Thu, 01 Oct 2009 14:29:35 +010015 -- Cody A.W. Somerville <cody.somerville@canonical.com> Thu, 01 Oct 2009 11:24:14 -0300
716
8usb-creator (0.2.8) karmic; urgency=low17usb-creator (0.2.8) karmic; urgency=low
918
1019
=== modified file 'usbcreator/install.py'
--- usbcreator/install.py 2009-10-01 13:30:00 +0000
+++ usbcreator/install.py 2009-10-01 17:00:29 +0000
@@ -223,34 +223,32 @@
223 os.path.join(self.target, 'syslinux', 'syslinux.cfg'))223 os.path.join(self.target, 'syslinux', 'syslinux.cfg'))
224 self.check()224 self.check()
225 225
226 # Mangle the configuration file based on the options we've selected.226 # Mangle the configuration files based on the options we've selected.
227 for filename in (os.path.join('syslinux', 'syslinux.cfg'),227 import glob
228 os.path.join('syslinux', 'adtext.cfg'),228 for filename in glob.iglob("%s/syslinux/*.cfg" % self.target):
229 os.path.join('syslinux', 'text.cfg')):
230 f = None229 f = None
231 try:230 try:
232 f = open(os.path.join(self.target, filename), 'r')231 f = open(filename, 'r')
233 label = ''232 label = ''
234 to_write = []233 to_write = []
235 for line in f.readlines():234 for line in f.readlines():
236 line = line.strip('\n').split(' ')235 line = line.strip('\n\t').split(' ')
237 for l in line:236 if len(line) and len(line[0]):
238 if l:237 command = line[0]
239 command = l238 if command.lower() == 'label':
240 break239 label = line[1].strip()
241 if command.lower() == 'append':240 elif command.lower() == 'append':
242 pos = line.index(command) + 2241 if label not in ('check', 'memtest', 'hd'):
243 if label not in ('check', 'memtest', 'hd'):242 if self.persist != 0:
244 if self.persist != 0:243 line.append('persistent')
245 line.insert(pos, 'persistent')244 line.append('cdrom-detect/try-usb=true')
246 line.insert(pos, 'cdrom-detect/try-usb=true')245 if label not in ('memtest', 'hd'):
247 if label not in ('memtest', 'hd'):246 line.append('noprompt')
248 line.insert(pos, 'noprompt')247 to_write.append(' '.join(line) + '\n')
249 elif command.lower() == 'label':248 else:
250 label = line[1].strip()249 pass
251 to_write.append(' '.join(line) + '\n')
252 f.close()250 f.close()
253 f = open(os.path.join(self.target, filename), 'w')251 f = open(filename, 'w')
254 f.writelines(to_write)252 f.writelines(to_write)
255 except (KeyboardInterrupt, SystemExit):253 except (KeyboardInterrupt, SystemExit):
256 raise254 raise
@@ -262,12 +260,6 @@
262 if f:260 if f:
263 f.close()261 f.close()
264 self.check()262 self.check()
265
266 # TODO evand 2009-07-23: Test whether present versions of syslinux
267 # still require syslinux.cfg at the root of the filesystem. This was
268 # supposed to have been fixed.
269 shutil.copy2(os.path.join(self.target, 'syslinux', 'syslinux.cfg'),
270 os.path.join(self.target, 'syslinux.cfg'))
271263
272 def create_persistence(self):264 def create_persistence(self):
273 logging.debug('create_persistence')265 logging.debug('create_persistence')

Subscribers

People subscribed via source and target branches