Skip to content
Snippets Groups Projects
Commit da3b97a1 authored by Marek Marczykowski-Górecki's avatar Marek Marczykowski-Górecki
Browse files

Handle FAT filesystem with fsimage comparator

parent b90bd2f6
No related branches found
No related tags found
1 merge request!13Make fsimage comparator handle FAT filesystem
...@@ -77,10 +77,23 @@ class FsImageContainer(Archive): ...@@ -77,10 +77,23 @@ class FsImageContainer(Archive):
class FsImageFile(File): class FsImageFile(File):
DESCRIPTION = "ext2/ext3/ext4/btrfs filesystems" DESCRIPTION = "ext2/ext3/ext4/btrfs/fat filesystems"
CONTAINER_CLASS = FsImageContainer CONTAINER_CLASS = FsImageContainer
FILE_TYPE_RE = re.compile(r'^(Linux.*filesystem data|BTRFS Filesystem).*') 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): def compare_details(self, other, source=None):
differences = [] differences = []
my_fs = '' my_fs = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment