| Current Path : /snap/core26/462/snap/ |
| Current File : //snap/core26/462/snap/snapcraft.yaml |
name: core26
adopt-info: bootstrap
summary: Runtime environment based on Ubuntu 26.04
description: |
The base snap based on the Ubuntu 26.04 release.
confinement: strict
type: base
build-base: core26
grade: stable
assumes:
- snapd2.55.5
# This is uncommented in our github builds for riscv64
## - isa-riscv64-rva23
parts:
# TODO: rewrite this once all slices are upstreamed to use chisel slices
# directly from canonical, instead of our own chisel-releases repo.
chisel-libs:
plugin: nil
build-packages:
- golang
- file
source: https://github.com/canonical/chisel-ubuntu-core.git
source-type: git
source-branch: '26.04'
override-build: |
# We use a file with env vars in $CRAFT_PROJECT_DIR to decide whether to
# include cloud-init or not. This file can be manually created for local
# builds, or created here if we are running from a launchpad recipe with
# suffix -cloud-init. This is detected by looking at the
# SNAPCRAFT_IMAGE_INFO env var injected in LP, which tells us the build
# url and has a form like:
#
# {
# "build-request-id": "lp-<id>",
# "build-request-timestamp": "<time>",
# "build_url": "https://launchpad.net/~ubuntu-core-service/+snap/core26-cloud-init/+build/<build_id>"
# }
#
# (although in one line).
(
cd "$CRAFT_PROJECT_DIR"
touch build-env
if printf "$SNAPCRAFT_IMAGE_INFO" | grep -q -- "-cloud-init/+build"
then echo "SNAP_BUILD_VARIANT=cloud-init" > build-env
fi
)
go install github.com/canonical/chisel/cmd/chisel@latest
# Define the system utilities that we want to include in the base
# These are the ones where we can probably slim down the number of binaries
# later on, but for now we include them all to ensure maximum compatibility.
UTILS=(
apparmor_bins
bash_bins
bzip2_scripts
coreutils-from-uutils_bins
diffutils_bins
dosfstools_bins
debianutils_which
debianutils_ischroot
debianutils_run-parts
file_bins
gdbserver_bins
gnu-coreutils_bins
gnutls-bin_bins
gpgv_bins
grep_bins
gzip_scripts
hostname_bins
iptables_bins
iputils-ping_bins
less_bins
login_bins
mawk_bins
ncurses-bin_bins
polkitd_bins
rfkill_bins
sed_bins
sudo-rs_bins
squashfs-tools_bins
tar_bins
util-linux_bins
util-linux-extra_hardware
util-linux-extra_process
util-linux-extra_login
vim-tiny_bins
)
# Define the system libraries and services that we want to include in the base
#
SLICES=(
apparmor_extras
base-files_motd
base-files_release-info
base-files_root-defaults
bash-completion_config
bash-completion_completions
ca-certificates_data-with-certs
cracklib-runtime_bins
cryptsetup_bins
cryptsetup-bin_bins
dbus_services
dbus-user-session_services
dhcpcd-base_standard
distro-info-data_data
dmsetup_rules
e2fsprogs_services
e2fsprogs_standard
fdisk_bins
fonts-ubuntu_all
fonts-ubuntu_config
finalrd_services
iproute2_bins
kmod_bins
kmod_config
libc6_config
libc6_gconv
libc-bin_iconv
libc-bin_nsswitch
libc-bin_ldconfig
libc-bin_locale
libc-bin_getconf
libc-bin_getent
libpam-modules_config
libpam-modules_pam-config
libpam-pwquality_pam-config
libpam-modules-bin_standard
libpam-modules-bin_extrausers
libpam-modules-bin_namespace
libpam-modules-bin_timestamp
libpam-systemd_libs
libengine-pkcs11-openssl_libs
libgnutls30t64_config
libopts25_libs
libp11-3t64_libs
libnss-mdns_mdns4-minimal
libnss-extrausers_libs
libpam-pwquality_libs
libpciaccess0_libs
libwrap0_host-files
libx11-data_xerrordb
locales_standard
netcat-openbsd_bins
netplan.io_bins
ncurses-base_terminfo
openssh-client_config
openssh-client_services
openssh-server_bins
openssh-server_config
openssh-server_services
openssl_bins
opensc_bins
p11-kit_bins
passwd_pam-config
polkitd_services
procps_bins
plymouth_bins
plymouth-label-ft_libs
procps_config
udev_services
util-linux_services
systemd_bash-completions
systemd_extras
systemd_run0
systemd_kernel-parameters
systemd_udev-rules
systemd_tpm2
systemd_standard
systemd_user-services
systemd-bootchart_services
systemd-coredump_bins
systemd-cryptsetup_bins
systemd-cryptsetup_services
systemd-resolved_bins
systemd-sysv_bins
systemd-timesyncd_services
systemd-zram-generator_services
tzdata_zoneinfo
wpasupplicant_services
)
. "$CRAFT_PROJECT_DIR"/build-env
SNAP_BUILD_VARIANT=${SNAP_BUILD_VARIANT:-}
if [ "$SNAP_BUILD_VARIANT" = cloud-init ]; then
SLICES+=(cloud-init_bins)
fi
# TODO: not sure about FIPS yet, this will have to come later, chisel has builtin
# support for ESM, meaning it's something we can request chisel to do for us.
# if [[ ${SNAP_FIPS_BUILD+x} ]]; then
# # Ensure vital crypt packages are refreshed / downgraded and downloaded
# # from the FIPS ppa. This should also contain openssh-server, but we already
# # have that one listed above.
# SLICES+=(libgcrypt20 libgnutls30t64 openssl-fips-module-3 ssh)
# fi
# add architecture specific slices
case "$(dpkg --print-architecture)" in
amd64|arm64)
SLICES+=(secureboot-db_services nvidia-kernel-common-595_bins nvidia-kernel-common-595_modprobe-d-kms)
;;
i386)
SLICES+=(secureboot-db_services)
;;
riscv64)
SLICES+=(gdbserver_bins systemd-bootchart_services)
;;
esac
# create the rootfs directory we install slices into
mkdir -p "${CRAFT_STAGE}"/base
# Cut the initial slices into the rootfs
chisel cut \
--release="${CRAFT_PART_SRC}" \
--root "${CRAFT_STAGE}"/base \
"${SLICES[@]}" "${UTILS[@]}" \
base-files_chisel
# Cut foreign libraries we also need
case "$(dpkg --print-architecture)" in
amd64)
chisel cut \
--arch=i386 \
--release="${CRAFT_PART_SRC}" \
--root "${CRAFT_STAGE}"/base \
libnss-mdns_mdns4-minimal libc6_libs libc6_gconv libc6_config libgcc-s1_libs
;;
esac
# https://documentation.ubuntu.com/chisel/en/latest/reference/manifest/
# chisel automatically generates a manifest for the cut slices here:
# $rootfs/var/lib/chisel/manifest.wall
# this is zstd compressed, and must therefor be uncompressed
# unzstd ./manifest.wall -o manifest.json
snapd-files:
plugin: nil
source: .
build-packages:
- snapd
after:
- chisel-libs
override-build: |
mkdir -p "${CRAFT_STAGE}"/base/usr/lib/systemd/system-generators
cp /usr/lib/systemd/system-generators/snapd-generator "${CRAFT_STAGE}"/base/usr/lib/systemd/system-generators/snapd-generator
cp /usr/lib/tmpfiles.d/snapd.conf "${CRAFT_STAGE}"/base/usr/lib/tmpfiles.d/snapd.conf
generators:
plugin: nil
source: generators/
build-packages:
- cargo
- rustc
override-build: |
cd "${CRAFT_PART_SRC}"
cargo build --release
strip target/release/ubuntu-core-generator
mkdir -p "${CRAFT_PART_INSTALL}/usr/lib/core"
install -m 755 target/release/ubuntu-core-generator \
"${CRAFT_PART_INSTALL}/usr/lib/core/ubuntu-core-generator"
splash-theme:
plugin: dump
source: https://github.com/snapcore/plymouth-theme-ubuntu-core.git
source-type: git
organize:
ubuntu-core: usr/share/plymouth/themes/ubuntu-core
copyright: usr/share/doc/plymouth-theme-ubuntu-core/copyright
stage:
- -README.md
bootstrap:
after:
- chisel-libs
- snapd-files
plugin: make
source: .
build-packages:
- shellcheck
- distro-info
- python3-debian
- python3-requests
- python3-yaml
# to generate changelogs, it's own snap need to be present,
# obviously for new core bases this cannot be the case, and
# we need to wait until the first release with introducing
# changelogs.
build-snaps:
- core26=latest/beta
override-pull: |
craftctl default
date_tag=$(./get-version.sh)
# detect whether we are doing a fips build on LP
if git remote get-url origin | grep "fips"; then
craftctl set version="$date_tag"+fips
echo "SNAP_BUILD_VARIANT=fips" > build-env
echo "SNAP_BUILD_NAME=core26-fips" >> build-env
else
craftctl set version=$date_tag
rm -f build-env
fi
override-prime: |
craftctl default
# run all the hooks
cd ${CRAFT_PART_SRC} && make hooks DESTDIR=${CRAFT_PRIME}
# ensure build-in tests are run
cd ${CRAFT_PART_SRC} && make test TESTDIR=${CRAFT_PRIME}