Skip to content

Commit

Permalink
utils.py: raise error if rootfs file size is not multiple of 16MiB.
Browse files Browse the repository at this point in the history
See: AOSC-Dev/aosc-asahi-installer@f46e12d,
if rootfs image size can not multipie of 16MiB, 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]>
  • Loading branch information
eatradish committed Nov 10, 2023
1 parent 5b81b34 commit db8f947
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def extract(self, src, dest):
self.pkg.extract(src, dest)

def fdcopy(self, sfd, dfd, size=None):
if size % (16 * 1024 * 1024) != 0:
raise Exception("The size of the rootfs image file must be a multiple of 16MiB.")
BLOCK = 16 * 1024 * 1024
copied = 0
bps = 0
Expand Down

0 comments on commit db8f947

Please sign in to comment.