[Merge] lp:~laney/livecd-rootfs/snap-seeding into lp:livecd-rootfs

Iain Lane iain at orangesquash.org.uk
Tue Nov 21 17:08:16 UTC 2017



Diff comments:

> === modified file 'live-build/auto/build'
> --- live-build/auto/build	2017-11-10 07:49:30 +0000
> +++ live-build/auto/build	2017-11-21 17:06:05 +0000
> @@ -367,40 +367,33 @@
>  		rm chroot/etc/apt/sources.list.preinstall chroot/etc/apt/sources.list.orig
>  	fi
>  	case $PROJECT:$SUBPROJECT in
> -		ubuntu-server:live|ubuntu-mate:*)
> -			assertions_dir="chroot/var/lib/snapd/seed/assertions"
> -			model_assertion="$assertions_dir/generic-classic.model"
> -			account_key_assertion="$assertions_dir/generic.account-key"
> -			account_assertion="$assertions_dir/generic.account"
> -
> -			mkdir -p "$assertions_dir"
> -			snap known --remote model series=16 \
> -				model=generic-classic brand-id=generic \
> -				> "$model_assertion"
> -			account_key=$(sed -n -e's/sign-key-sha3-384: //p' \
> -				< "$model_assertion")
> -
> -			snap known --remote account-key \
> -				public-key-sha3-384="$account_key" \
> -				> "$account_key_assertion"
> -			account=$(sed -n -e's/account-id: //p' \
> -				< "$account_key_assertion")
> -
> -			snap known --remote account account-id=generic \
> -				> "$account_assertion"
> -			;;
> -	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
> +		*)

I kept the case statement so that if any flavours don't want snaps they have a place to opt out.

> +			if [ -e "config/seeded-snaps" ]; then
> +				assertions_dir="chroot/var/lib/snapd/seed/assertions"
> +				model_assertion="$assertions_dir/generic-classic.model"
> +				account_key_assertion="$assertions_dir/generic.account-key"
> +				account_assertion="$assertions_dir/generic.account"
> +
> +				mkdir -p "$assertions_dir"
> +				snap known --remote model series=16 \
> +					model=generic-classic brand-id=generic \
> +					> "$model_assertion"
> +				account_key=$(sed -n -e's/sign-key-sha3-384: //p' \
> +					< "$model_assertion")
> +
> +				snap known --remote account-key \
> +					public-key-sha3-384="$account_key" \
> +					> "$account_key_assertion"
> +				account=$(sed -n -e's/account-id: //p' \
> +					< "$account_key_assertion")
> +
> +				snap known --remote account account-id=generic \
> +					> "$account_assertion"
> +				snap_list=$(cat config/seeded-snaps)
> +				preinstall_snaps $snap_list
> +			fi
> +			;;
> +	esac
>  
>  	if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then
>  		if [ "$ARCH" = "armhf" ]; then
> 
> === modified file 'live-build/auto/config'
> --- live-build/auto/config	2017-11-13 17:15:11 +0000
> +++ live-build/auto/config	2017-11-21 17:06:05 +0000
> @@ -254,13 +254,74 @@
>  	OPTS="${OPTS:+$OPTS }--bootstrap-flavour=minimal --linux-packages=linux-image"
>  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
>  	ubuntu|ubuntu-dvd)
>  		add_task install minimal standard ubuntu-desktop
>  		LIVE_TASK='ubuntu-live'
> +		BASE_SEED='desktop'

Couldn't think of a better way than hardcoding this in here, would be open to ideas.

> +		SEEDS_EXPANDED=$(inheritance ${BASE_SEED})
>  		case $ARCH in
>  			amd64)	add_package live $SIGNED_KERNEL_PACKAGE ;;
>  		esac
> +		for seed in ${SEEDS_EXPANDED}; do
> +			echo "snap: considering ${seed}"
> +			file=config/germinate-output/${seed}.snap
> +			[ -e "${file}" ] || continue
> +			# extract the first column (snap package name) from germinate's output
> +			seed_snaps=$(sed -rn '1,/-----/d;/-----/,$d; s/(.*) \|.*/\1/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
>  		;;
>  
>  	ubuntu-desktop-next)


-- 
https://code.launchpad.net/~laney/livecd-rootfs/snap-seeding/+merge/334061
Your team Ubuntu Core Development Team is requested to review the proposed merge of lp:~laney/livecd-rootfs/snap-seeding into lp:livecd-rootfs.



More information about the Ubuntu-reviews mailing list