mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-03-25 18:01:17 +00:00
Allow custom model assertions in snap_prepare_assertions
This also splits up the preparation in to two functions, so that images that want to use a custom model assertion but don't have any snaps to preinstall don't end up with the core snap installed.
This commit is contained in:
parent
862ace223d
commit
54649b40c3
@ -412,9 +412,12 @@ EOF
|
||||
(cd $snaps_dir; ls -1 ${SNAP_NAME}_*.snap) >> $seed_yaml
|
||||
}
|
||||
|
||||
snap_prepare() {
|
||||
# Configure basic snapd assertions and pre-seeds the 'core' snap
|
||||
snap_prepare_assertions() {
|
||||
# Configure basic snapd assertions
|
||||
local CHROOT_ROOT=$1
|
||||
# Optional. If set, should be a colon-separated string of brand:model to be
|
||||
# used for the image's model assertion
|
||||
local CUSTOM_BRAND_MODEL=$2
|
||||
|
||||
local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
|
||||
local snaps_dir="$seed_dir/snaps"
|
||||
@ -426,9 +429,16 @@ snap_prepare() {
|
||||
mkdir -p "$assertions_dir"
|
||||
mkdir -p "$snaps_dir"
|
||||
|
||||
local brand="generic"
|
||||
local model="generic-classic"
|
||||
if [ -n "$CUSTOM_BRAND_MODEL" ] ; then
|
||||
brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)"
|
||||
brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)"
|
||||
fi
|
||||
|
||||
if ! [ -e "$model_assertion" ] ; then
|
||||
snap known --remote model series=16 \
|
||||
model=generic-classic brand-id=generic \
|
||||
model=$model brand-id=$brand \
|
||||
> "$model_assertion"
|
||||
fi
|
||||
|
||||
@ -446,6 +456,16 @@ snap_prepare() {
|
||||
snap known --remote account account-id=$account \
|
||||
> "$account_assertion"
|
||||
fi
|
||||
}
|
||||
|
||||
snap_prepare() {
|
||||
# Configure basic snapd assertions and pre-seeds the 'core' snap
|
||||
local CHROOT_ROOT=$1
|
||||
# Optional. If set, should be a colon-separated string of brand:model to be
|
||||
# used for the image's model assertion
|
||||
local CUSTOM_BRAND_MODEL=$2
|
||||
|
||||
snap_prepare_assertions "$CHROOT_ROOT" "$CUSTOM_BRAND_MODEL"
|
||||
|
||||
# Download the core snap
|
||||
if ! [ -f $snaps_dir/core_[0-9]*.snap ] ; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user