[Merge] ~xnox/livecd-rootfs:snap-preseed-channel-specification into livecd-rootfs:ubuntu/master

David Krauser david.krauser at canonical.com
Tue Jun 30 18:56:47 UTC 2020


Review: Needs Fixing

Adding comments inline.

Diff comments:

> diff --git a/live-build/functions b/live-build/functions
> index e9fbb50..d188460 100644
> --- a/live-build/functions
> +++ b/live-build/functions
> @@ -620,11 +620,26 @@ snap_prepare() {
>  snap_preseed() {
>      # Preseed a snap in the image (snap_prepare must be called once prior)
>      local CHROOT_ROOT=$1
> +    # $2 can be in the form of snap_name/classic=track/risk/branch
>      local SNAP=$2
> +    # strip CHANNEL specification
> +    local SNAP_NAME=${SNAP%=*}
> +    # strip /classic confinement
>      local SNAP_NAME=${SNAP%/*}

You're re-declaring SNAP_NAME here, and you're also expanding SNAP again.

Was that on purpose? Should it be this instead?

SNAP_NAME=${SNAP_NAME%/*}

> -    # Per Ubuntu policy, all seeded snaps (with the exception of the core
> -    # snap) must pull from stable/ubuntu-$(release_ver) as their channel.
> -    local CHANNEL=${3:-"stable/ubuntu-$(release_ver)"}
> +    # Seed from the specified channel (e.g. core18 latest/stable)
> +    # Or Channel endcoded in the snap name (e.g. lxd=4.0/stable/ubuntu-20.04)
> +    # Or Ubuntu policy default channel latest/stable/ubuntu-$(release_ver)
> +    local CHANNEL=$3
> +    if [ -z "$CHANNEL" ]; then
> +        case $2 in
> +            *=*)
> +                CHANNEL=${2#*=}
> +                ;;
> +            *)
> +                CHANNEL="stable/ubuntu-$(release_ver)"
> +                ;;
> +        esac
> +    fi
>  
>      if [ ! -e "$CHROOT_ROOT/var/lib/snapd/seed/assertions/model" ]; then
>          echo "ERROR: Snap model assertion not present, snap_prepare must be called"


-- 
https://code.launchpad.net/~xnox/livecd-rootfs/+git/livecd-rootfs/+merge/385774
Your team Ubuntu Core Development Team is subscribed to branch livecd-rootfs:ubuntu/master.



More information about the Ubuntu-reviews mailing list