Commit da3b97a1 authored by Marek Marczykowski-Górecki's avatar Marek Marczykowski-Górecki
Browse files

Handle FAT filesystem with fsimage comparator

parent b90bd2f6
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -77,10 +77,23 @@ class FsImageContainer(Archive):


class FsImageFile(File):
    DESCRIPTION = "ext2/ext3/ext4/btrfs filesystems"
    DESCRIPTION = "ext2/ext3/ext4/btrfs/fat filesystems"
    CONTAINER_CLASS = FsImageContainer
    FILE_TYPE_RE = re.compile(r'^(Linux.*filesystem data|BTRFS Filesystem).*')

    @classmethod
    def recognizes(cls, file):
        # Avoid DOS / MBR file type as it generate a lot of false possitives,
        # manually check "System identifier string" instead
        with open(file.path, 'rb') as f:
            f.seek(54)
            if f.read(8) in (b'FAT12   ', b'FAT16   '):
                return True
            f.seek(82)
            if f.read(8) == b'FAT32   ':
                return True
        return super().recognizes(file)

    def compare_details(self, other, source=None):
        differences = []
        my_fs = ''