update quick-test-this-branch.sh too

This commit is contained in:
Michael Hudson-Doyle 2021-07-21 10:42:25 +12:00
parent 9a4871f416
commit 9e0f11c02e
1 changed files with 11 additions and 34 deletions

View File

@ -2,46 +2,23 @@
set -eux
src="$(dirname "$(dirname "$(readlink -f "${0}")")")"
LIVEFS_EDITOR="${LIVEFS_EDITOR-$src/livefs-editor}"
[ -d $LIVEFS_EDITOR ] || git clone https://github.com/mwhudson/livefs-editor $LIVEFS_EDITOR
LIVEFS_EDITOR=$(readlink -f $LIVEFS_EDITOR)
old_iso="$(readlink -f "${1}")"
new_iso="$(readlink -f "${2}")"
tmpdir="$(mktemp -d)"
cd "${tmpdir}"
_MOUNTS=()
PYTHONPATH=$LIVEFS_EDITOR python3 -m livefs_edit $old_iso /dev/null --setup-rootfs \
--shell 'cp rootfs//var/lib/snapd/seed/snaps/subiquity_*.snap '$tmpdir'/old.snap'
do_mount_existing () {
local mountpoint="${!#}"
mount "$@"
_MOUNTS=("${mountpoint}" "${_MOUNTS[@]+"${_MOUNTS[@]}"}")
}
$src/scripts/slimy-update-snap.sh old.snap subiquity_new.snap
do_mount () {
local mountpoint="${!#}"
mkdir "${mountpoint}"
do_mount_existing "$@"
}
clean_mounts () {
for m in "${_MOUNTS[@]+"${_MOUNTS[@]}"}"; do
umount "${m}"
done
_MOUNTS=()
}
cleanup () {
clean_mounts
rm -rf "${tmpdir}"
}
trap cleanup EXIT
do_mount $old_iso old_iso
do_mount old_iso/casper/installer.squashfs installer
$src/scripts/slimy-update-snap.sh installer/var/lib/snapd/seed/snaps/subiquity_*.snap subiquity_new.snap
clean_mounts
$src/scripts/inject-subiquity-snap.sh $old_iso subiquity_new.snap $new_iso
PYTHONPATH=$LIVEFS_EDITOR python3 -m livefs_edit $old_iso $new_iso --inject-snap subiquity_new.snap