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.
This commit is contained in:
Jean-Baptiste Lallement 2018-11-15 12:15:19 +01:00
parent 903ba3b276
commit 78c196031b

View File

@ -481,8 +481,10 @@ EOF
# Create layered squashfs system # Create layered squashfs system
CURPASS=1 CURPASS=1
PREVPASS=""
LASTPASS=$(echo $PASSES|wc -w) LASTPASS=$(echo $PASSES|wc -w)
prev_manifest="" prev_manifest=""
to_remove=""
if [ "${IMAGEFORMAT:-}" = live-layered ]; then if [ "${IMAGEFORMAT:-}" = live-layered ]; then
for _PASS in $PASSES for _PASS in $PASSES
do do
@ -493,11 +495,25 @@ EOF
mksquashfs . ${squashfs_f} \ mksquashfs . ${squashfs_f} \
-no-progress -xattrs -comp xz ) -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" squashfs_f_manifest="${base}.manifest"
create_manifest "chroot.${_PASS}/" "${squashfs_f_manifest}.full" 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 diff -NU0 ${prev_manifest}.full ${squashfs_f_manifest}.full|grep -v ^@ > $squashfs_f_manifest
prev_manifest=$squashfs_f_manifest prev_manifest=$squashfs_f_manifest
# Full ISO manifest
if [ $CURPASS -eq $LASTPASS ]; then if [ $CURPASS -eq $LASTPASS ]; then
cp "${squashfs_f_manifest}.full" livecd.${PROJECT}.manifest cp "${squashfs_f_manifest}.full" livecd.${PROJECT}.manifest
fi fi
@ -505,8 +521,12 @@ EOF
squashfs_f_size="${base}.size" squashfs_f_size="${base}.size"
du -B 1 -s "chroot.${_PASS}/" | cut -f1 > "${squashfs_f_size}" du -B 1 -s "chroot.${_PASS}/" | cut -f1 > "${squashfs_f_size}"
PREVPASS=${_PASS}
CURPASS=$(( CURPASS + 1 )) CURPASS=$(( CURPASS + 1 ))
done done
if [ -n "${to_remove}" ]; then
rm -r ${to_remove}
fi
fi fi
# Teardown mount points in layered mode # Teardown mount points in layered mode