mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-23 03:11:12 +00:00
Allow hooks to replace generic snap assertion
The generic assertion will be put in place if there are preseeded snaps. A hook that wants to add its own model should be able to overwrite the generic assertion. This patch allows a hook to continue unchanged calling snap_prepare_assertions with a custom brand/model. The patch will replace the generic brand/model if a custom brand/model is specified. Prior to this patch the generic brand/model would remain in place.
This commit is contained in:
parent
9f96dcb4de
commit
52e5a2b25b
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -4,6 +4,7 @@ livecd-rootfs (2.541) UNRELEASED; urgency=medium
|
||||
|
||||
[ Robert C Jennings ]
|
||||
* Add the server snap seed to the ubuntu-cpc project
|
||||
* Allow hooks to replace generic snap assertion
|
||||
|
||||
-- Michael Hudson-Doyle <mwhudson@debian.org> Wed, 26 Sep 2018 12:43:23 +1200
|
||||
|
||||
|
@ -427,6 +427,22 @@ snap_prepare_assertions() {
|
||||
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
|
||||
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 \
|
||||
|
Loading…
x
Reference in New Issue
Block a user