liveusb/creator.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit 00e28a5c1f7f96590d6b8f59a5b6f3177e4e519c Author: Luke Macken lmacken@redhat.com Date: Mon Dec 7 17:20:52 2009 -0500
Do our filesystem checking even if the device is already mounted
diff --git a/liveusb/creator.py b/liveusb/creator.py index cc601f9..2b7a403 100755 --- a/liveusb/creator.py +++ b/liveusb/creator.py @@ -469,14 +469,14 @@ class LinuxLiveUSBCreator(LiveUSBCreator): def mount_device(self): """ Mount our device with HAL if it is not already mounted """ import dbus + if not self.fstype: + raise LiveUSBError(_("Unknown filesystem. Your device " + "may need to be reformatted.")) + if self.fstype not in self.valid_fstypes: + raise LiveUSBError(_("Unsupported filesystem: %s") % + self.fstype) self.dest = self.drive['mount'] if not self.dest: - if not self.fstype: - raise LiveUSBError(_("Unknown filesystem. Your device " - "may need to be reformatted.")) - if self.fstype not in self.valid_fstypes: - raise LiveUSBError(_("Unsupported filesystem: %s") % - self.fstype) try: self.log.debug("Calling %s.Mount('', %s, [], ...)" % ( self.drive['udi'], self.fstype))
commit 5e5bedde1857fdf6a703283a9c3d9042babd5fd7 Author: Luke Macken lmacken@redhat.com Date: Mon Dec 7 17:14:54 2009 -0500
Handle unsupported filesystems before mounting the device
diff --git a/liveusb/creator.py b/liveusb/creator.py index 524d8ca..cc601f9 100755 --- a/liveusb/creator.py +++ b/liveusb/creator.py @@ -62,6 +62,7 @@ class LiveUSBCreator(object): _drive = None # mountpoint of the currently selected drive mb_per_sec = 0 # how many megabytes per second we can write log = None + valid_fstypes = ('vfat', 'msdos', 'ext2', 'ext3')
drive = property(fget=lambda self: self.drives[self._drive], fset=lambda self, d: self._set_drive(d)) @@ -471,8 +472,11 @@ class LinuxLiveUSBCreator(LiveUSBCreator): self.dest = self.drive['mount'] if not self.dest: if not self.fstype: - raise LiveUSBError(_("Filesystem for %s unknown!" % - self.drive['device'])) + raise LiveUSBError(_("Unknown filesystem. Your device " + "may need to be reformatted.")) + if self.fstype not in self.valid_fstypes: + raise LiveUSBError(_("Unsupported filesystem: %s") % + self.fstype) try: self.log.debug("Calling %s.Mount('', %s, [], ...)" % ( self.drive['udi'], self.fstype)) @@ -532,9 +536,9 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
def verify_filesystem(self): self.log.info(_("Verifying filesystem...")) - if self.fstype not in ('vfat', 'msdos', 'ext2', 'ext3'): + if self.fstype not in self.valid_fstypes: if not self.fstype: - raise LiveUSBError(_("Unknown filesystem for %s. Your device " + raise LiveUSBError(_("Unknown filesystem. Your device " "may need to be reformatted.")) else: raise LiveUSBError(_("Unsupported filesystem: %s" %
liveusb-creator@lists.stg.fedorahosted.org