@@ -72,6 +72,8 @@ actions:
7272 # stored on the subvolume and inherited by files added later (kernel updates).
7373 btrfs property set "$IMAGEMNTDIR/boot" compression none
7474 mount -t btrfs -o "{{ $btrfsopts }},subvol=@home" "$ROOTPART" "$IMAGEMNTDIR/home"
75+ # @snapshots is mounted only for the build (to write the Factory Image); it's
76+ # not in fstab, so the .snapshots mountpoint is removed from @ before detach.
7577 mount -t btrfs -o "{{ $btrfsopts }},subvol=@snapshots" "$ROOTPART" "$IMAGEMNTDIR/.snapshots"
7678 mount -t btrfs -o "{{ $btrfsopts }},subvol=@var-log" "$ROOTPART" "$IMAGEMNTDIR/var/log"
7779 mount -t btrfs -o "{{ $btrfsopts }},subvol=@var-cache" "$ROOTPART" "$IMAGEMNTDIR/var/cache"
@@ -82,7 +84,9 @@ actions:
8284 append-kernel-cmdline : rootflags=subvol=@ {{ $cmdline }}
8385
8486 # Add fstab entries for the non-root subvolumes (debos only generated the root
85- # line). The FSUUID is read back at build time.
87+ # line). The FSUUID is read back at build time. @snapshots is intentionally
88+ # omitted -- it holds the Factory Image and is mounted on demand for rollback,
89+ # never auto-mounted at runtime.
8690 - action : run
8791 description : Append subvolume entries to /etc/fstab
8892 chroot : false
@@ -93,7 +97,6 @@ actions:
9397 cat >> "$IMAGEMNTDIR/etc/fstab" <<EOF
9498 UUID=$FSUUID /boot btrfs {{ $btrfsopts }},subvol=boot 0 0
9599 UUID=$FSUUID /home btrfs {{ $btrfsopts }},subvol=@home 0 0
96- UUID=$FSUUID /.snapshots btrfs {{ $btrfsopts }},subvol=@snapshots 0 0
97100 UUID=$FSUUID /var/log btrfs {{ $btrfsopts }},subvol=@var-log 0 0
98101 UUID=$FSUUID /var/cache btrfs {{ $btrfsopts }},subvol=@var-cache 0 0
99102 EOF
@@ -132,4 +135,5 @@ actions:
132135 findmnt -rno TARGET --submounts "$IMAGEMNTDIR" \
133136 | awk -v root="$IMAGEMNTDIR" '$0 != root' \
134137 | awk '{ print length, $0 }' | sort -rn | cut -d" " -f2- \
135- | while read -r mp; do umount "$mp"; done
138+ | while read -r mp; do umount "$mp"; done
139+ rmdir "$IMAGEMNTDIR/.snapshots"
0 commit comments