flatcar / sysext-bakery

Recipes for baking systemd-sysext images
Apache License 2.0
72 stars 37 forks source link

flix and flatwrap: Add tools to convert a chroot to a sysext #74

Closed pothos closed 6 months ago

pothos commented 6 months ago

Existing binaries can be bundled in a sysext image if they use their own library path or do what Flatpak does and run in a chroot. This introduces the Flix tool which creates sysext images from a given chroot and a set of binaries in it, and then patches the ELF rpath section and to refer to a custom library path. The other tool introduced here is the Flatwrap tool that creates sysext images from a given chroot and a set of binaries in it, and sets up wrapper entry points with bwrap/unshare into the chroot. This also introduces a helper oci-rootfs.sh to create a useable chroot from a container image.

How to use/Testing done

See README

pothos commented 6 months ago

For flatwrap it's up to the user to decide whether /etc, /var and /home are from the container or the host. I need to make the selection more user friendly with special args for these three common cases. Done: Now mapped from host by default.

pothos commented 6 months ago

Relaxed the constraint that one has to have a merged /usr in the chroot. Now one can specify thing in a separate /bin (or /etc/systemd/system/) by mapping it to /usr/bin (or /usr/lib/systemd/system/).