From e59db65edb6bf6faacc4f0afd104ba99ad246dc5 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Sat, 7 Oct 2017 05:17:27 +0000 Subject: [PATCH 1/4] Add initial support for preinstallation of snaps in images, and preinstall pulsemixer in the Ubuntu MATE image. --- debian/changelog | 7 +++++++ live-build/auto/build | 48 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/debian/changelog b/debian/changelog index de0d48ed..f4e97157 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +livecd-rootfs (2.469) UNRELEASED; urgency=medium + + * Add initial support for preinstallation of snaps in images, and + preinstall pulsemixer in the Ubuntu MATE image. + + -- Steve Langasek Fri, 06 Oct 2017 16:23:49 -0700 + livecd-rootfs (2.468) artful; urgency=medium [ Dimitri John Ledkov ] diff --git a/live-build/auto/build b/live-build/auto/build index 5b1e147e..c1a52ade 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -27,6 +27,43 @@ fi # Setup cleanup function Setup_cleanup +preinstall_snaps() { + lb chroot_resolv install + Chroot chroot sh -c ' + set -x; + cd /var/lib/snapd/seed; + SNAPPY_STORE_NO_CDN=1 snap download core' + for snap in "$@"; do + Chroot chroot sh -c " + set -x; + cd /var/lib/snapd/seed; + SNAPPY_STORE_NO_CDN=1 snap download \"$snap\"" + done + lb chroot_resolv remove + + CORE_SNAP=$(cd chroot/var/lib/snapd/seed; ls -1 core_*.snap) + + cat < chroot/var/lib/snapd/seed/seed.yaml +snaps: + - name: core + channel: stable + file: ${CORE_SNAP} +EOF + for snap in "$@"; do + cat <> chroot/var/lib/snapd/seed/seed.yaml + - name: $snap + channel: stable +EOF + echo -n " file: " >> chroot/var/lib/snapd/seed/seed.yaml + (cd chroot/var/lib/snapd/seed; ls -1 "${snap}_*.snap") \ + >> chroot/var/lib/snapd/seed/seed.yaml + done + + mv chroot/var/lib/snapd/seed/*.assert \ + chroot/var/lib/snapd/seed/assertions/ + mv chroot/var/lib/snapd/seed/*.snap chroot/var/lib/snapd/seed/snaps/ +} + rm -f binary.success ( if [ -d config/gnupg ]; then @@ -322,6 +359,17 @@ deb file:/var/lib/preinstalled-pool/ $LB_DISTRIBUTION $LB_PARENT_ARCHIVE_AREAS ;; esac + # FIXME: this should not be a hard-coded list in this script; this + # is an interim solution for 17.10. + case $PROJECT:$SUBPROJECT in + ubuntu-mate:*) + SNAP_LIST=pulsemixer + ;; + esac + if [ -n "$SNAP_LIST" ]; then + preinstall_snaps $SNAP_LIST + fi + if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then if [ "$ARCH" = "armhf" ]; then INFO_DESC="$(lsb_release -d -s)" From c61850e16896a3ccc1d867645ed13a4d02ab4897 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Sat, 7 Oct 2017 20:51:54 +0000 Subject: [PATCH 2/4] Use regular chroot, not the Chroot wrapper, so we can actually debug our failing command --- live-build/auto/build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index c1a52ade..39a7902c 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -29,12 +29,12 @@ Setup_cleanup preinstall_snaps() { lb chroot_resolv install - Chroot chroot sh -c ' + chroot chroot sh -c ' set -x; cd /var/lib/snapd/seed; SNAPPY_STORE_NO_CDN=1 snap download core' for snap in "$@"; do - Chroot chroot sh -c " + chroot chroot sh -c " set -x; cd /var/lib/snapd/seed; SNAPPY_STORE_NO_CDN=1 snap download \"$snap\"" From aec4452acfde06b43e682206fe453ddaf29ad432 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Sat, 7 Oct 2017 21:15:32 +0000 Subject: [PATCH 3/4] Fix quoting --- live-build/auto/build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live-build/auto/build b/live-build/auto/build index 39a7902c..a26a5f05 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -55,7 +55,7 @@ EOF channel: stable EOF echo -n " file: " >> chroot/var/lib/snapd/seed/seed.yaml - (cd chroot/var/lib/snapd/seed; ls -1 "${snap}_*.snap") \ + (cd chroot/var/lib/snapd/seed; ls -1 ${snap}_*.snap) \ >> chroot/var/lib/snapd/seed/seed.yaml done From 1bcb0009ac4dfc03f0e2a6747e1e53f782076573 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Sat, 7 Oct 2017 21:35:16 +0000 Subject: [PATCH 4/4] mkdir before use --- live-build/auto/build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/live-build/auto/build b/live-build/auto/build index a26a5f05..89fbd270 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -59,6 +59,8 @@ EOF >> chroot/var/lib/snapd/seed/seed.yaml done + mkdir -p chroot/var/lib/snapd/seed/snaps \ + chroot/var/lib/snapd/seed/assertions mv chroot/var/lib/snapd/seed/*.assert \ chroot/var/lib/snapd/seed/assertions/ mv chroot/var/lib/snapd/seed/*.snap chroot/var/lib/snapd/seed/snaps/