mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-23 03:11:12 +00:00
snap_preseed: support channel specification with snap name
snap_name[/classic]=track/risk/branch is now the supported snap name specification, which allows to specify the full default track and optional classic confinemnt. Supporting such specification in the seedtext allows one to specify a better default channel. For example, this will allow lxd to switch from latest/stable/ubuntu-20.04 to 4.0/stable/ubuntu-20.04 as 4.0 is the LTS track matching 20.04 support timeframe. LP: #1882374
This commit is contained in:
parent
40103430d8
commit
7bae9201d2
@ -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
|
||||
local SNAP_NAME=${SNAP%/*}
|
||||
# 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)"}
|
||||
# strip CHANNEL specification
|
||||
local SNAP_NAME=${SNAP%=*}
|
||||
# strip /classic confinement
|
||||
SNAP_NAME=${SNAP_NAME%/*}
|
||||
# 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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user