Compare commits

..
1 Commits
Author SHA1 Message Date
hulthe d528b55473 Inject universal /slim/init instead of requiring container-specific setup
CI / build (pull_request) Successful in 13s
slim now works with any Containerfile by injecting distro-agnostic scripts
at build time:

- /slim/init: mounts special filesystems, configures networking (static
  QEMU slirp), sets up cgroup2, timezone, and rootless container prereqs.
  Parses slim.cmd=<base64> from the kernel cmdline for runtime overrides,
  otherwise execs /slim/exec.

- /slim/exec: generated from the image's CMD/ENTRYPOINT (via podman image
  inspect), overridable via --cmd at build and run time.

Changes:
- New src/inject.rs: inspect image config, infer command, generate
  /slim/exec script, inject /slim/ into mounted rootfs
- New src/scripts/slim-init.sh: the universal init script (include_str!)
- build.rs: rename --init to --cmd, inject scripts before packing,
  drop Meta::save, restructure to ensure unmount always runs
- qemu.rs: hardcode init=/slim/init, add --cmd (base64 on cmdline),
  drop Meta::load, add -no-reboot
- Remove src/meta.rs and meta.toml (no longer needed)
- Cargo.toml: add serde_json + base64, remove unused walkdir + cpio + toml
- Example Containerfiles simplified to plain FROM + CMD
- New example/test.sh for manual verification
- README updated for new workflow
2026-09-08 09:36:15 +02:00
+1 -1
View File
@@ -118,7 +118,7 @@ fn to_raw_ext4(dir: &Path, tmp_dir: &Path) -> Result<NamedTempFile> {
let size = used let size = used
+ (used / 10) // Add 10% + (used / 10) // Add 10%
// TODO: make configurable // TODO: make configurable
+ 4 * gb; // Add some spare capacity for activities + 64 * gb; // Add some spare capacity for activities
let size = size.to_string(); let size = size.to_string();
let raw_file = NamedTempFile::new_in(tmp_dir)?; let raw_file = NamedTempFile::new_in(tmp_dir)?;