Skip to content

Commit a5a71c6

Browse files
committed
fix(rootfs-to-image): create NFS rootfs archive after hooks finalize the tree
The archive was created inside the if/else block at the top of create_image_from_sdcard_rootfs(), BEFORE update_initramfs and pre_umount_final_image hooks run. Any rootfs changes made by those hooks (initramfs regeneration, fstab fixups, extension tweaks) were missing from the archive. Move archive creation to after pre_umount_final_image so the tarball captures the fully finalized rootfs tree.
1 parent ea4dd9f commit a5a71c6

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

lib/functions/image/rootfs-to-image.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ function create_image_from_sdcard_rootfs() {
5151
--exclude="/sys/*" \
5252
$exclude_home \
5353
--info=progress0,stats1 $SDCARD/ $MOUNT/
54-
else
55-
display_alert "Creating rootfs archive" "rootfs.tgz" "info"
56-
tar cp --xattrs --directory=$SDCARD/ --exclude='./boot/*' --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
57-
--exclude='./sys/*' $exclude_home . |
58-
pv -p -b -r -s "$(du -sb "$SDCARD"/ | cut -f1)" \
59-
-N "$(logging_echo_prefix_for_pv "create_rootfs_archive") rootfs.tgz" |
60-
gzip -c > "$DEST/images/${version}-rootfs.tgz"
6154
fi
6255

6356
# stage: rsync /boot
@@ -110,6 +103,15 @@ function create_image_from_sdcard_rootfs() {
110103
Called before unmounting both `/root` and `/boot`.
111104
PRE_UMOUNT_FINAL_IMAGE
112105

106+
if [[ $ROOTFS_TYPE == nfs ]]; then
107+
display_alert "Creating rootfs archive" "rootfs.tgz" "info"
108+
tar cp --xattrs --directory=$SDCARD/ --exclude='./boot/*' --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
109+
--exclude='./sys/*' $exclude_home . |
110+
pv -p -b -r -s "$(du -sb "$SDCARD"/ | cut -f1)" \
111+
-N "$(logging_echo_prefix_for_pv "create_rootfs_archive") rootfs.tgz" |
112+
gzip -c > "$DEST/images/${version}-rootfs.tgz"
113+
fi
114+
113115
if [[ "${SHOW_DEBUG}" == "yes" ]]; then
114116
# Check the partition table after the uboot code has been written
115117
display_alert "Partition table after write_uboot" "$LOOP" "debug"

0 commit comments

Comments
 (0)