def test_clonezilla_image(self): image = ClonezillaImage( "/mnt/backup/clonezilla.focal/2020-08-30-15-img_mbr_many_different_fs/clonezilla-img" ) # assert_true("message", False) # assert_false("message", True) image = ClonezillaImage( "/mnt/backup/clonezilla.focal/2020-09-02-07-img_ntfsclone_partimage/clonezilla-img" ) # sdf2.aa : Partimage # sdf6.ntfs-img.aa : NTFS Clone # sdf13.ext4-ptcl-img.gz.aa : Partclone ext4 # sdf13.dd-ptcl-img.gz.aa : Partclone dd (same as regular dd data, it would appear) print("looking at " + str(image.dev_fs_dict))
def scan_file(self, absolute_path, filename, enduser_filename): print("Scan file " + absolute_path) is_image = False try: image = None if isfile(absolute_path): # Identify Clonezilla images by presence of a file named "parts". Cannot use "clonezilla-img" or # "dev-fs.list" because these files were not created by in earlier Clonezilla versions. Cannot use # "disk" as Clonezilla's 'saveparts' function does not create it. But both 'savedisk' and 'saveparts' # always creates a file named 'parts' across every version of Clonezilla tested. error_suffix = "" if absolute_path.endswith("parts"): print("Found Clonezilla image " + filename) image = ClonezillaImage(absolute_path, enduser_filename) error_suffix = _( "This can happen when loading images which Clonezilla was unable to completely backup. Any other filesystems within the image should be restorable as normal." ) is_image = True elif absolute_path.endswith(".backup"): print( "Found a legacy Redo Backup / Rescuezilla v1.0.5 image " + filename) image = RedoBackupLegacyImage(absolute_path, enduser_filename, filename) error_suffix = _( "Any other filesystems within the image should be restorable as normal." ) is_image = True if is_image: image_warning_message = "" for short_partition_key in image.warning_dict.keys(): image_warning_message += " " + short_partition_key + ": " + image.warning_dict[ short_partition_key] + "\n" if len(image_warning_message) > 0: self.failed_to_read_image_dict[absolute_path] = _( "Unable to fully process the image associated with the following partitions:" ) + "\n" + image_warning_message + error_suffix if image is not None: self.image_dict[image.absolute_path] = image except Exception as e: print("Failed to read: " + absolute_path) tb = traceback.format_exc() self.failed_to_read_image_dict[enduser_filename] = tb traceback.print_exc() return is_image