diff options
-rwxr-xr-x | morphlib/exts/rawdisk.write | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/morphlib/exts/rawdisk.write b/morphlib/exts/rawdisk.write index 7d0ebaee..0e9453fb 100755 --- a/morphlib/exts/rawdisk.write +++ b/morphlib/exts/rawdisk.write @@ -43,11 +43,15 @@ class RawDiskWriteExtension(morphlib.writeexts.WriteExtension): raise cliapp.AppException('Wrong number of command line args') temp_root, location = args - if os.path.isfile(location): + # If the location exists and is a file, then try to upgrade it. + # The 'isfile' call should fail also if the location is a device, + # and the 'is_device' check shouldn't be needed here. + if os.path.isfile(location) and not self.is_device(location): self.upgrade_local_system(location, temp_root) else: try: - self.create_raw_disk_image(location) + if not self.is_device(location): + self.create_raw_disk_image(location) self.create_local_system(temp_root, location) self.status(msg='Disk image has been created at %s' % location) except Exception: |