mirror of
https://github.com/vhaudiquet/ecrou.git
synced 2026-11-12 22:22:44 +00:00
The pool carries an arm64 libkrunfw5 next to the amd64 one, so the part now picks the flavor and the install path from the target arch (CRAFT_ARCH_BUILD_FOR / CRAFT_ARCH_TRIPLET_BUILD_FOR) with the checksum pinned per arch. riscv64 goes: the pool has no libkrunfw5 build for it, and libkrun does not target it.
110 lines
3.5 KiB
YAML
110 lines
3.5 KiB
YAML
name: ecrou
|
|
base: core26
|
|
version: "0.1.0"
|
|
summary: The strictly confined microVM runtime
|
|
description: |
|
|
ecrou boots disposable Linux environments as one-shot microVMs on
|
|
libkrun: it resolves an image reference, boots one VM per command
|
|
with live stdio, propagates the exit code, and throws the machine
|
|
away. Persistence crosses an explicit `-v/--volume` share or it does not
|
|
happen.
|
|
|
|
## First run
|
|
|
|
Connect the KVM interface (home and network connect on their own):
|
|
|
|
sudo snap connect ecrou:kvm
|
|
|
|
Then run a command in a microVM:
|
|
|
|
ecrou run ubuntu -- uname -a
|
|
|
|
## Diagnostics
|
|
|
|
`ecrou probe` reports what a run would find: KVM, libkrun, the
|
|
cache directory.
|
|
|
|
## Configuration and cache
|
|
|
|
- image cache: `~/snap/ecrou/common/cache/ecrou`
|
|
|
|
The home interface does not cover dotfiles, so the XDG
|
|
directories are redirected into the snap's common data area.
|
|
license: MIT
|
|
grade: stable
|
|
confinement: strict
|
|
|
|
platforms:
|
|
amd64:
|
|
arm64:
|
|
|
|
apps:
|
|
ecrou:
|
|
command: bin/ecrou
|
|
command-chain: [command-chain/ecrou-env]
|
|
plugs:
|
|
- home
|
|
- network
|
|
- kvm
|
|
|
|
parts:
|
|
ecrou:
|
|
plugin: rust
|
|
source: .
|
|
rust-channel: "1.98.1"
|
|
rust-path: [crates/ecrou-cli]
|
|
build-packages: [cmake, perl]
|
|
override-build: |
|
|
craftctl default
|
|
# The home interface stops at dotfiles, so ~/.cache is
|
|
# unreachable under strict confinement. Point the XDG cache
|
|
# lookup (the dirs crate honors the variable) into the snap's
|
|
# durable area, shared across refreshes.
|
|
mkdir -p "$CRAFT_PART_INSTALL/command-chain"
|
|
cat > "$CRAFT_PART_INSTALL/command-chain/ecrou-env" <<'EOF'
|
|
#!/bin/sh
|
|
XDG_CACHE_HOME="$SNAP_USER_COMMON/cache"
|
|
export XDG_CACHE_HOME
|
|
mkdir -p "$XDG_CACHE_HOME"
|
|
exec "$@"
|
|
EOF
|
|
chmod 755 "$CRAFT_PART_INSTALL/command-chain/ecrou-env"
|
|
|
|
libkrun:
|
|
plugin: rust
|
|
source: https://github.com/containers/libkrun
|
|
source-type: git
|
|
source-tag: v1.19.7
|
|
source-depth: 1
|
|
rust-channel: "1.98.1"
|
|
override-build: |
|
|
cargo build --release -p libkrun --features net
|
|
install -Dm755 target/release/libkrun.so \
|
|
"$CRAFT_PART_INSTALL/lib/libkrun.so.1.19.7"
|
|
ln -s libkrun.so.1.19.7 "$CRAFT_PART_INSTALL/lib/libkrun.so.1"
|
|
|
|
libkrunfw:
|
|
plugin: nil
|
|
# libkrunfw5 ships only in stonking universe today, not in any LTS
|
|
# base, so the .deb comes straight from the pool — one flavor per
|
|
# target arch. The library embeds its kernel and has no external
|
|
# symbols, so it runs on the base's older glibc. The pool carries
|
|
# no riscv64 build, and libkrun does not target riscv64, so the
|
|
# snap builds for amd64 and arm64 only.
|
|
build-packages: [curl]
|
|
override-pull: |
|
|
arch="$CRAFT_ARCH_BUILD_FOR"
|
|
case "$arch" in
|
|
amd64) digest="924cd545080aaf5da66740d12a51b7a5cbd9a5c0b502d21cbef9bc82bf1c8b6b" ;;
|
|
arm64) digest="9570e82feac79fd41a6a9674cc02a9b2f09948ac30ad480d05fc73a957843e56" ;;
|
|
*) echo "no libkrunfw5 build for $arch in the Ubuntu pool" >&2; exit 1 ;;
|
|
esac
|
|
curl -fL -o libkrunfw5.deb \
|
|
"https://archive.ubuntu.com/ubuntu/pool/universe/libk/libkrunfw/libkrunfw5_5.5.0+ds-1_${arch}.deb"
|
|
echo "$digest libkrunfw5.deb" | sha256sum -c
|
|
override-build: |
|
|
dpkg -x libkrunfw5.deb unpack
|
|
install -Dm755 "unpack/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libkrunfw.so.5.5.0" \
|
|
"$CRAFT_PART_INSTALL/lib/libkrunfw.so.5.5.0"
|
|
ln -s libkrunfw.so.5.5.0 "$CRAFT_PART_INSTALL/lib/libkrunfw.so.5"
|