Skip to content

Commit 763ee10

Browse files
WhatAmISupposedToPutHerejannau
authored andcommitted
Move fdcopy 4k check to the caller
fdcopy is used by more things than just the rootfs image Signed-off-by: Sasha Finkelstein <[email protected]>
1 parent 7f3725e commit 763ee10

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/osinstall.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ def install(self, stub_ins):
147147
p_plain(f" Extracting {image} into {info.name} partition...")
148148
logging.info(f"Extract: {image}")
149149
zinfo = self.pkg.getinfo(image)
150+
if zinfo.file_size % (4 * 1024) != 0:
151+
raise Exception("The size of the rootfs image file must be a multiple of 4KiB.")
150152
with self.pkg.open(image) as sfd, \
151153
open(f"/dev/r{info.name}", "r+b") as dfd:
152154
self.fdcopy(sfd, dfd, zinfo.file_size)

src/util.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ 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.")
202200
BLOCK = 16 * 1024 * 1024
203201
copied = 0
204202
bps = 0

0 commit comments

Comments
 (0)