Skip to content

Commit 4e58a1c

Browse files
eatradishdavide125
authored andcommitted
utils.py: raise error if rootfs file size is not multiple of 4KiB.
See: AOSC-Dev/aosc-asahi-installer@f46e12d, if rootfs image size can not multipie of 4KiB, asahi-installer will raise `EINVAL`, users don't know whats happen ... The point of this commit is to look for illegitimate rootfs image sizes in advance, so that the raise error becomes clear. Signed-off-by: eatradish <[email protected]>
1 parent 920fb05 commit 4e58a1c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ def extract(self, src, dest):
197197
self.extract_file(src, dest_path)
198198

199199
def fdcopy(self, sfd, dfd, size=None):
200+
if size is not None and size % (4 * 1024) != 0:
201+
raise Exception("The size of the rootfs image file must be a multiple of 4KiB.")
200202
BLOCK = 16 * 1024 * 1024
201203
copied = 0
202204
bps = 0

0 commit comments

Comments
 (0)