mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-03-10 10:51:11 +00:00
Support seeding of snaps, as emitted by germinate >= 2.27.
This commit is contained in:
commit
9978fd7b39
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
|||||||
|
livecd-rootfs (2.491) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* Support seeding of snaps, as emitted by germinate >= 2.27.
|
||||||
|
|
||||||
|
-- Iain Lane <iain.lane@canonical.com> Tue, 30 Jan 2018 10:05:49 +0000
|
||||||
|
|
||||||
livecd-rootfs (2.490) bionic; urgency=medium
|
livecd-rootfs (2.490) bionic; urgency=medium
|
||||||
|
|
||||||
* ubuntu-cpc: Initramfs compression should match default for
|
* ubuntu-cpc: Initramfs compression should match default for
|
||||||
|
@ -43,7 +43,7 @@ preinstall_snaps() {
|
|||||||
chroot chroot sh -c "
|
chroot chroot sh -c "
|
||||||
set -x;
|
set -x;
|
||||||
cd /var/lib/snapd/seed;
|
cd /var/lib/snapd/seed;
|
||||||
SNAPPY_STORE_NO_CDN=1 snap download \"$snap\""
|
SNAPPY_STORE_NO_CDN=1 snap download \"${snap%/*}\""
|
||||||
done
|
done
|
||||||
lb chroot_resolv remove
|
lb chroot_resolv remove
|
||||||
|
|
||||||
@ -56,12 +56,14 @@ snaps:
|
|||||||
file: ${CORE_SNAP}
|
file: ${CORE_SNAP}
|
||||||
EOF
|
EOF
|
||||||
for snap in "$@"; do
|
for snap in "$@"; do
|
||||||
|
snap_name=${snap%/*}
|
||||||
cat <<EOF >> chroot/var/lib/snapd/seed/seed.yaml
|
cat <<EOF >> chroot/var/lib/snapd/seed/seed.yaml
|
||||||
- name: $snap
|
- name: ${snap_name}
|
||||||
channel: stable
|
channel: stable
|
||||||
EOF
|
EOF
|
||||||
|
case ${snap} in */classic) echo " classic: true" >> chroot/var/lib/snapd/seed/seed.yaml;; esac
|
||||||
echo -n " file: " >> chroot/var/lib/snapd/seed/seed.yaml
|
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_name}_*.snap) \
|
||||||
>> chroot/var/lib/snapd/seed/seed.yaml
|
>> chroot/var/lib/snapd/seed/seed.yaml
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -368,7 +370,8 @@ deb file:/var/lib/preinstalled-pool/ $LB_DISTRIBUTION $LB_PARENT_ARCHIVE_AREAS
|
|||||||
rm chroot/etc/apt/sources.list.preinstall chroot/etc/apt/sources.list.orig
|
rm chroot/etc/apt/sources.list.preinstall chroot/etc/apt/sources.list.orig
|
||||||
fi
|
fi
|
||||||
case $PROJECT:$SUBPROJECT in
|
case $PROJECT:$SUBPROJECT in
|
||||||
ubuntu-server:live|ubuntu-mate:*)
|
*)
|
||||||
|
if [ -e "config/seeded-snaps" ]; then
|
||||||
assertions_dir="chroot/var/lib/snapd/seed/assertions"
|
assertions_dir="chroot/var/lib/snapd/seed/assertions"
|
||||||
model_assertion="$assertions_dir/generic-classic.model"
|
model_assertion="$assertions_dir/generic-classic.model"
|
||||||
account_key_assertion="$assertions_dir/generic.account-key"
|
account_key_assertion="$assertions_dir/generic.account-key"
|
||||||
@ -389,19 +392,11 @@ deb file:/var/lib/preinstalled-pool/ $LB_DISTRIBUTION $LB_PARENT_ARCHIVE_AREAS
|
|||||||
|
|
||||||
snap known --remote account account-id=generic \
|
snap known --remote account account-id=generic \
|
||||||
> "$account_assertion"
|
> "$account_assertion"
|
||||||
;;
|
snap_list=$(cat config/seeded-snaps)
|
||||||
esac
|
preinstall_snaps $snap_list
|
||||||
|
|
||||||
# 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
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then
|
if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then
|
||||||
if [ "$ARCH" = "armhf" ]; then
|
if [ "$ARCH" = "armhf" ]; then
|
||||||
|
@ -254,6 +254,53 @@ if [ "${SUBPROJECT:-}" = minimized ]; then
|
|||||||
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal --linux-packages=linux-image"
|
OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal --linux-packages=linux-image"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# cribbed from cdimage, perhaps this should be a small helper script in germinate?
|
||||||
|
add_inheritance () {
|
||||||
|
case " $inherit " in
|
||||||
|
*" $1 "*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
inherit="${inherit:+$inherit }$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
expand_inheritance () {
|
||||||
|
for seed in $(grep "^$1:" config/germinate-output/structure | cut -d: -f2); do
|
||||||
|
expand_inheritance "$seed"
|
||||||
|
done
|
||||||
|
add_inheritance "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
inheritance () {
|
||||||
|
inherit=
|
||||||
|
expand_inheritance "$1"
|
||||||
|
echo "$inherit"
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir -p config/germinate-output
|
||||||
|
case $PROJECT in
|
||||||
|
kubuntu-active*)
|
||||||
|
SEED=kubuntu-active.$SUITE
|
||||||
|
;;
|
||||||
|
kubuntu*)
|
||||||
|
SEED=kubuntu.$SUITE
|
||||||
|
;;
|
||||||
|
xubuntu*)
|
||||||
|
SEED=xubuntu.$SUITE
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
SEED=ubuntu.$SUITE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if ! [ -e config/germinate-output/structure ]; then
|
||||||
|
echo "Running germinate..."
|
||||||
|
(cd config/germinate-output && germinate --no-rdepends --no-installer \
|
||||||
|
-S $SEEDMIRROR -m $MIRROR -d $SUITE -s $SEED \
|
||||||
|
${COMPONENTS:+-c "$COMPONENTS"} -a $ARCH)
|
||||||
|
fi
|
||||||
|
|
||||||
case $PROJECT in
|
case $PROJECT in
|
||||||
ubuntu|ubuntu-dvd)
|
ubuntu|ubuntu-dvd)
|
||||||
add_task install minimal standard ubuntu-desktop
|
add_task install minimal standard ubuntu-desktop
|
||||||
@ -593,6 +640,32 @@ case $PROJECT in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# we'll expand the base seed given here according to the STRUCTURE file, and
|
||||||
|
# then look in all of the seeds found to see which snaps are seeded
|
||||||
|
case $PROJECT in
|
||||||
|
ubuntu|kubuntu*|lubuntu*|xubuntu*|ubuntu-mate*|ubuntustudio*|ubuntukylin*|ubuntu-budgie*)
|
||||||
|
BASE_SEED='desktop'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "${BASE_SEED}" ]; then
|
||||||
|
SEEDS_EXPANDED=$(inheritance ${BASE_SEED})
|
||||||
|
for seed in ${SEEDS_EXPANDED}; do
|
||||||
|
echo "snap: considering ${seed}"
|
||||||
|
file=config/germinate-output/${seed}.snaps
|
||||||
|
[ -e "${file}" ] || continue
|
||||||
|
# extract the first column (snap package name) from germinate's output
|
||||||
|
# translate the human-readable "foo (classic)" into a
|
||||||
|
# more machine readable "foo/classic"
|
||||||
|
seed_snaps=$(sed -rn '1,/-----/d;/-----/,$d; s/(.*) \|.*/\1/; s, \(classic\),/classic,; p' "${file}")
|
||||||
|
for snap in ${seed_snaps}; do
|
||||||
|
echo "snap: found ${snap}"
|
||||||
|
ALL_SNAPS="${ALL_SNAPS:+${ALL_SNAPS} }${snap}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
echo "${ALL_SNAPS}" > config/seeded-snaps
|
||||||
|
fi
|
||||||
|
|
||||||
export APT_OPTIONS
|
export APT_OPTIONS
|
||||||
|
|
||||||
if [ "$PREINSTALLED" != "true" ] && [ "$LIVE_TASK" ]; then
|
if [ "$PREINSTALLED" != "true" ] && [ "$LIVE_TASK" ]; then
|
||||||
@ -926,51 +999,8 @@ case ${SUBPROJECT:-} in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# cribbed from cdimage, perhaps this should be a small helper script in germinate?
|
|
||||||
add_inheritance () {
|
|
||||||
case " $inherit " in
|
|
||||||
*" $1 "*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
inherit="${inherit:+$inherit }$1"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
expand_inheritance () {
|
|
||||||
for seed in $(grep "^$1:" config/germinate-output/structure | cut -d: -f2); do
|
|
||||||
expand_inheritance "$seed"
|
|
||||||
done
|
|
||||||
add_inheritance "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
inheritance () {
|
|
||||||
inherit=
|
|
||||||
expand_inheritance "$1"
|
|
||||||
echo "$inherit"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$PREINSTALLED" = "true" ]; then
|
if [ "$PREINSTALLED" = "true" ]; then
|
||||||
if [ -n "$PREINSTALL_POOL_SEEDS" ]; then
|
if [ -n "$PREINSTALL_POOL_SEEDS" ]; then
|
||||||
mkdir -p config/germinate-output
|
|
||||||
case $PROJECT in
|
|
||||||
kubuntu-active*)
|
|
||||||
SEED=kubuntu-active.$SUITE
|
|
||||||
;;
|
|
||||||
kubuntu*)
|
|
||||||
SEED=kubuntu.$SUITE
|
|
||||||
;;
|
|
||||||
xubuntu*)
|
|
||||||
SEED=xubuntu.$SUITE
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
SEED=ubuntu.$SUITE
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
(cd config/germinate-output && germinate --no-rdepends --no-installer \
|
|
||||||
-S $SEEDMIRROR -m $MIRROR -d $SUITE -s $SEED \
|
|
||||||
${COMPONENTS:+-c "$COMPONENTS"} -a $ARCH)
|
|
||||||
|
|
||||||
UNWANTED_SEEDS="${LIVE_TASK:+$LIVE_TASK }boot installer required"
|
UNWANTED_SEEDS="${LIVE_TASK:+$LIVE_TASK }boot installer required"
|
||||||
for i in $UNWANTED_SEEDS; do
|
for i in $UNWANTED_SEEDS; do
|
||||||
UNWANTED_SEEDS="${UNWANTED_SEEDS:+$UNWANTED_SEEDS }$(inheritance $i)"
|
UNWANTED_SEEDS="${UNWANTED_SEEDS:+$UNWANTED_SEEDS }$(inheritance $i)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user