From 78c196031b801d2babef10fe9d04e26de709dc00 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lallement Date: Thu, 15 Nov 2018 12:15:19 +0100 Subject: [PATCH] Add snaps to manifest Make sure that all the snaps are listed in the full manifest of each layer and as delta in the delta manifest. --- live-build/auto/build | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/live-build/auto/build b/live-build/auto/build index 3332708a..b2bfdcc5 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -481,8 +481,10 @@ EOF # Create layered squashfs system CURPASS=1 + PREVPASS="" LASTPASS=$(echo $PASSES|wc -w) prev_manifest="" + to_remove="" if [ "${IMAGEFORMAT:-}" = live-layered ]; then for _PASS in $PASSES do @@ -493,11 +495,25 @@ EOF mksquashfs . ${squashfs_f} \ -no-progress -xattrs -comp xz ) + # Full manifest until that PASS + # Note: snaps won't be listed in the new layer by snap-seed-parse + # if no newly snap was installed in that layer. Copy and then remove it + # just to create the correct full manifest and avoid a new layer + # chroot mount dance. + SNAPPATH=var/lib/snapd/seed/seed.yaml + if [ ! -f "chroot.${_PASS}/${SNAPPATH}" ] && [ -n "${PREVPASS}" ] && [ -f "chroot.${PREVPASS}/${SNAPPATH}" ]; then + mkdir -p chroot.${_PASS}/$(dirname ${SNAPPATH}) + cp "chroot.${PREVPASS}/${SNAPPATH}" "chroot.${_PASS}/${SNAPPATH}" + to_remove="chroot.${_PASS}/var/lib/snapd ${to_remove}" + fi squashfs_f_manifest="${base}.manifest" create_manifest "chroot.${_PASS}/" "${squashfs_f_manifest}.full" - # We want manifest to only contain the diff of current pass + + # Delta manifest diff -NU0 ${prev_manifest}.full ${squashfs_f_manifest}.full|grep -v ^@ > $squashfs_f_manifest prev_manifest=$squashfs_f_manifest + + # Full ISO manifest if [ $CURPASS -eq $LASTPASS ]; then cp "${squashfs_f_manifest}.full" livecd.${PROJECT}.manifest fi @@ -505,8 +521,12 @@ EOF squashfs_f_size="${base}.size" du -B 1 -s "chroot.${_PASS}/" | cut -f1 > "${squashfs_f_size}" + PREVPASS=${_PASS} CURPASS=$(( CURPASS + 1 )) done + if [ -n "${to_remove}" ]; then + rm -r ${to_remove} + fi fi # Teardown mount points in layered mode