liveusb/creator.py

Luke Macken lmacken at fedoraproject.org
Wed Nov 2 19:36:26 UTC 2011


 liveusb/creator.py |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 7cdd743eccd2fc62a78a932d39a8d750116f8f56
Author: Luke Macken <lmacken at redhat.com>
Date:   Wed Nov 2 15:36:07 2011 -0400

    Always set the device label to 'LIVE' (#800)

diff --git a/liveusb/creator.py b/liveusb/creator.py
index 479f4bc..23e89ca 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -50,7 +50,7 @@ class LiveUSBCreator(object):
     """ An OS-independent parent class for Live USB Creators """
 
     iso = None          # the path to our live image
-    label = "LIVE"    # if one doesn't already exist
+    label = "LIVE"      # if one doesn't already exist
     fstype = None       # the format of our usb stick
     drives = {}         # {device: {'label': label, 'mount': mountpoint}}
     overlay = 0         # size in mb of our persisten overlay
@@ -612,9 +612,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             else:
                 raise LiveUSBError(_("Unsupported filesystem: %s" %
                                      self.fstype))
-        if self.drive['label']:
-            self.label = self.drive['label']
-        else:
+        if self.drive['label'] != self.label:
             self.log.info("Setting %s label to %s" % (self.drive['device'],
                                                       self.label))
             try:
@@ -630,7 +628,6 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
                                                         self.label))
             except LiveUSBError, e:
                 self.log.error("Unable to change volume label: %s" % str(e))
-                self.label = None
 
     def extract_iso(self):
         """ Extract self.iso to self.dest """
@@ -981,16 +978,13 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
                                  "and format your USB key with the FAT "
                                  "filesystem." % vol[-1]))
         self.fstype = 'vfat'
-        if vol[0] == '':
+        if vol[0] != self.label:
             try:
                 win32file.SetVolumeLabel(self.drive['device'], self.label)
                 self.log.debug("Set %s label to %s" % (self.drive['device'],
-                                                      self.label))
+                                                       self.label))
             except pywintypes.error, e:
                 self.log.warning("Unable to SetVolumeLabel: " + str(e))
-                self.label = None
-        else:
-            self.label = vol[0].replace(' ', '_')
 
     def get_free_bytes(self, device=None):
         """ Return the number of free bytes on our selected drive """




More information about the liveusb-creator mailing list