mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-06-21 07:01:30 +00:00
Ensure snap models have been added prior to snap preseeding
This commit is contained in:
parent
8d603cc87f
commit
0e00214cc6
@ -427,8 +427,7 @@ snap_prepare_assertions() {
|
|||||||
local brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)"
|
local brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)"
|
||||||
local model="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)"
|
local model="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)"
|
||||||
|
|
||||||
# Clear the assertions if a hook wants to prepare a new
|
# Clear the assertions if they already exist
|
||||||
# assertion that isn't the default generic:generic-classic
|
|
||||||
if [ -e "$model_assertion" ] ; then
|
if [ -e "$model_assertion" ] ; then
|
||||||
existing_model=$(sed -n 's/^model: \(.*\)$/\1/p' $model_assertion)
|
existing_model=$(sed -n 's/^model: \(.*\)$/\1/p' $model_assertion)
|
||||||
existing_brand=$(sed -n 's/^brand-id: \(.*\)$/\1/p' $model_assertion)
|
existing_brand=$(sed -n 's/^brand-id: \(.*\)$/\1/p' $model_assertion)
|
||||||
@ -452,7 +451,6 @@ snap_prepare_assertions() {
|
|||||||
> "$account_key_assertion"
|
> "$account_key_assertion"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if ! [ -e "$account_assertion" ] ; then
|
if ! [ -e "$account_assertion" ] ; then
|
||||||
local account=$(sed -n -e's/account-id: //p' < "$account_key_assertion")
|
local account=$(sed -n -e's/account-id: //p' < "$account_key_assertion")
|
||||||
snap known --remote account account-id=$account \
|
snap known --remote account account-id=$account \
|
||||||
@ -486,5 +484,9 @@ snap_preseed() {
|
|||||||
# snap) must pull from stable/ubuntu-$(release_ver) as their channel.
|
# snap) must pull from stable/ubuntu-$(release_ver) as their channel.
|
||||||
local CHANNEL=${3:-"stable/ubuntu-$(release_ver)"}
|
local CHANNEL=${3:-"stable/ubuntu-$(release_ver)"}
|
||||||
|
|
||||||
|
if [ ! -e "$CHROOT_ROOT/var/lib/snapd/seed/assertions/model" ]; then
|
||||||
|
echo "ERROR: Snap model assertion not present, snap_prepare must be called"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
_snap_preseed $CHROOT_ROOT $SNAP $CHANNEL
|
_snap_preseed $CHROOT_ROOT $SNAP $CHANNEL
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user