[Merge] lp:~rcj/livecd-rootfs/trunk into lp:livecd-rootfs

Robert C Jennings robert.jennings at canonical.com
Thu Sep 27 17:46:53 UTC 2018



Diff comments:

> 
> === modified file 'live-build/functions'
> --- live-build/functions	2018-05-28 14:39:06 +0000
> +++ live-build/functions	2018-09-27 16:43:32 +0000
> @@ -427,6 +427,22 @@
>      local brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)"
>      local model="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)"
>  
> +    # Clear the assertions if a hook wants to prepare a new
> +    # assertion that isn't the default generic:generic-classic
> +    if [ -e "$model_assertion" ] ; then

This is run each time a snap is installed so if you installed.  If you didn't do any checking you'd make 3 calls to the snap store per snap to set up assertions.  But also you don't specify the brand/model when you install snaps which is why once you've changed from generic you don't clear things out. Usage looks like this today:

# all images
for_each preseed_snap:
  snap_install snap
     snap_prepare_assertions generic:generic-classic (implicit)
# cloud binary hook
snap_prepare_assertions cloudy:custom (explicit)
for_each cloud_snap:
   snap_install snap
     snap_prepare_assertions generic:generic-classic (implicit)

> +        existing_model=$(sed -n 's/^model: \(.*\)$/\1/p' $model_assertion)
> +        existing_brand=$(sed -n 's/^brand-id: \(.*\)$/\1/p' $model_assertion)
> +        if [ "$existing_model" == "generic-classic" ] &&
> +           [ "$existing_brand" == "generic" ] &&
> +           ( [ "$existing_model" != "$model" ] ||
> +             [ "$existing_brand" != "$brand" ] ); then
> +            echo "snap_prepare_assertions: clearing $existing_brand:$existing_model for $brand:$model"
> +            rm "$model_assertion"
> +            rm "$account_key_assertion"
> +            rm "$account_assertion"
> +       fi
> +    fi
> +
>      if ! [ -e "$model_assertion" ] ; then
>          snap known --remote model series=16 \
>              model=$model brand-id=$brand \


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



More information about the Ubuntu-reviews mailing list