liveusb/creator.py | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
New commits:
commit 6ecd8af4b6f5e98542434b666c97a73622bbee20
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Dec 12 13:44:20 2013 -0700
Pull the ldlinux-specific code out into it's own method, and call it elsewhere.
diff --git a/liveusb/creator.py b/liveusb/creator.py
index b3bdffc..4b4da76 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -324,9 +324,20 @@ class LiveUSBCreator(object):
except Exception, e:
self.log.warning(_("Unable to copy %s to %s: %s") % (infile, outfile, str(e)))
+ def delete_ldlinux(self):
+ # Don't prompt about overwriting files from mtools (#491234)
+ for ldlinux in [os.path.join(self.dest, p, 'ldlinux.sys')
+ for p in ('syslinux', '')]:
+ self.log.debug('Looking for %s' % ldlinux)
+ if os.path.isfile(ldlinux):
+ self.log.debug(_("Removing") + " %s" % ldlinux)
+ self.popen('chattr -i "%s"' % ldlinux, passive=True)
+ os.unlink(ldlinux)
+
def delete_liveos(self):
""" Delete the existing LiveOS """
self.log.info(_('Removing existing Live OS'))
+ self.delete_ldlinux()
for path in [self.get_liveos(),
os.path.join(self.dest + os.path.sep, 'syslinux'),
os.path.join(self.dest + os.path.sep, 'isolinux')]:
@@ -708,14 +719,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
if copied:
break
- # Don't prompt about overwriting files from mtools (#491234)
- for ldlinux in [os.path.join(self.dest, p, 'ldlinux.sys')
- for p in ('syslinux', '')]:
- self.log.debug('Looking for %s' % ldlinux)
- if os.path.isfile(ldlinux):
- self.log.debug(_("Removing") + " %s" % ldlinux)
- self.popen('chattr -i "%s"' % ldlinux, passive=True)
- os.unlink(ldlinux)
+ self.delete_ldlinux()
if self.drive['fstype'] in self.ext_fstypes:
shutil.move(os.path.join(syslinux_path, "syslinux.cfg"),