Reset /var/lib/snapd in the upper layers before calling snap prepare-image

canary-as-default
Steve Langasek 1 year ago committed by Michael Hudson-Doyle
parent d3a75c9bec
commit b43e3b84f4

2
debian/changelog vendored

@ -6,6 +6,8 @@ livecd-rootfs (23.10.21) UNRELEASED; urgency=medium
[ Steve Langasek ] [ Steve Langasek ]
* Deduplicate snaps between squashfs layers on classic: * Deduplicate snaps between squashfs layers on classic:
- Consolidate canary layers to merge 'classic' back into 'standard' - Consolidate canary layers to merge 'classic' back into 'standard'
- Reset /var/lib/snapd in the upper layers before calling snap
prepare-image
-- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 23 Aug 2023 11:15:26 +1200 -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 23 Aug 2023 11:15:26 +1200

@ -1230,3 +1230,14 @@ EOF
undivert_grub "${mountpoint}" undivert_grub "${mountpoint}"
fi fi
} }
# find all files under /var/lib/snapd in the target directory that aren't
# shipped by the snapd package itself, and remove them
reset_snapd_state() {
rootdir="$1"
rm -rf "$rootdir/var/lib/snapd"
setup_mountpoint "$rootdir"
chroot "$rootdir" apt-get install --reinstall -y snapd
teardown_mountpoint "$rootdir"
}

@ -20,6 +20,7 @@ case ${SUBPROJECT:-} in
esac esac
. config/binary . config/binary
. config/functions
# env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 brand-id=canonical model=ubuntu-classic-2310-amd64 > config/classic-model.model # env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 brand-id=canonical model=ubuntu-classic-2310-amd64 > config/classic-model.model
cat <<EOF > config/classic-model.model cat <<EOF > config/classic-model.model
@ -134,6 +135,9 @@ channel=""
if [ -n "${CHANNEL:-}" ]; then if [ -n "${CHANNEL:-}" ]; then
channel="--channel $CHANNEL" channel="--channel $CHANNEL"
fi fi
reset_snapd_state chroot
env SNAPPY_STORE_NO_CDN=1 snap prepare-image \ env SNAPPY_STORE_NO_CDN=1 snap prepare-image \
--classic config/classic-model.model $channel chroot --classic config/classic-model.model $channel chroot
mv chroot/system-seed/systems/* chroot/system-seed/systems/enhanced-secureboot-desktop mv chroot/system-seed/systems/* chroot/system-seed/systems/enhanced-secureboot-desktop

@ -20,6 +20,7 @@ case ${SUBPROJECT:-} in
esac esac
. config/binary . config/binary
. config/functions
# env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 brand-id=canonical model=ubuntu-installer-classic-2310-amd64 > config/classic-model-installer.model # env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 brand-id=canonical model=ubuntu-installer-classic-2310-amd64 > config/classic-model-installer.model
cat <<EOF > config/classic-model-installer.model cat <<EOF > config/classic-model-installer.model
@ -130,6 +131,9 @@ channel=""
if [ -n "${CHANNEL:-}" ]; then if [ -n "${CHANNEL:-}" ]; then
channel="--channel $CHANNEL" channel="--channel $CHANNEL"
fi fi
reset_snapd_state chroot
env SNAPPY_STORE_NO_CDN=1 snap prepare-image \ env SNAPPY_STORE_NO_CDN=1 snap prepare-image \
--classic config/classic-model-installer.model $channel chroot --classic config/classic-model-installer.model $channel chroot
mv chroot/system-seed/systems/* chroot/system-seed/systems/classic-installer mv chroot/system-seed/systems/* chroot/system-seed/systems/classic-installer

Loading…
Cancel
Save