Skip to content

Commit f17cff4

Browse files
committed
handle emptyfs with rootfs leading ./ check
1 parent 8078c28 commit f17cff4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/penguin/gen_image.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,9 @@ def make_image(fs, out, artifacts, proj_dir, config_path):
535535
MODIFIED_TARBALL = Path(ARTIFACTS, f"fs_out_{suffix}.tar")
536536
config = load_config(proj_dir, config_path)
537537
with tempfile.TemporaryDirectory() as TMP_DIR:
538-
first_entry = check_output(["tar", "xvpsf", IN_TARBALL, "-C", TMP_DIR]).splitlines()[0]
539-
if first_entry != b"./":
538+
contents = check_output(["tar", "xvpsf", IN_TARBALL, "-C", TMP_DIR]).splitlines()
539+
# Gracefully handle emptyfs
540+
if contents and contents[0] != b"./":
540541
logger.warning("Filesystem tar does not have a leading ./")
541542
logger.warning("You may encounter strange errors due to unexpected rootfs format!")
542543
logger.warning("You can resolve this by running fw2tar on your filesystem.")

0 commit comments

Comments
 (0)