Allow to install core snap optionally

Commit 245f7772bdb74 added code to abort the build if a snap wants to
install "core" (the 16.04 runtime). That's great but there are still
some CPC maintained image builds that use snaps based on "core". So
make it possible to continue the build if the "ALLOW_CORE_SNAP" env
variable is set.

(cherry picked from commit 34735684d5208981b2413047f67ee4c363d718d8)
This commit is contained in:
Thomas Bechtold 2022-03-04 13:57:09 +01:00
parent febe9e3f8b
commit edc244249a

View File

@ -562,8 +562,13 @@ _snap_preseed() {
# If snap info does not list a base the default is 'core'
# which is now an error to use.
if [ -z "$core_snap" ]; then
echo "Legacy snap with no base declaration found, refusing to install 'core' snap"
exit 1
if [ -z "$ALLOW_CORE_SNAP" ]; then
echo "Legacy snap with no base declaration found, refusing to install 'core' snap"
exit 1
else
echo "Legacy snap with no base declaration found, but \$ALLOW_CORE_SNAP set. continue (but FIX YOUR SNAPS!)"
core_snap=${core_snap:-core}
fi
fi
_snap_preseed $CHROOT_ROOT $core_snap stable