diff --git a/scripts/quick-test-this-branch.sh b/scripts/quick-test-this-branch.sh index aef69d46..13ec0d13 100755 --- a/scripts/quick-test-this-branch.sh +++ b/scripts/quick-test-this-branch.sh @@ -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