Make portable and sysext work

Proven by recognition through systemd-dissect.
This commit is contained in:
Tobias Strobel 2024-03-23 00:46:43 +01:00
parent a8bd0d8a8b
commit 046f9e5fcd
6 changed files with 36 additions and 31 deletions

View File

@ -0,0 +1,9 @@
#!/bin/sh
set -eu
OUTPUT="${IMAGE_ID}_${IMAGE_VERSION}.sysext"
mkdir -p "$DESTDIR/usr/lib/extension-release.d/"
cat >"$DESTDIR/usr/lib/extension-release.d/extension-release.$OUTPUT" <<EOF
SYSEXT_SCOPE=system
SYSEXT_PRETTY_NAME="mkosi — Build Bespoke OS Images"
EOF

View File

@ -2,9 +2,11 @@
Dependencies=base
[Output]
# See: https://uapi-group.org/specifications/specs/extension_image/
Format=sysext
Overlay=yes
Output=mkosi_%v.sysext
ImageId=mkosi
Output=%i_%v.%t
SectorSize=4096
# For Reproducible Builds
Seed=834dd70f55be43cc9934b20fc0b7f7be

View File

@ -1,14 +0,0 @@
#!/bin/bash
set -eu
mkdir -p /usr/lib/extension-release.d/
cat >/usr/lib/extension-release.d/extension-release.mkosi <<EOF
ID=rafeOS
SYSEXT_ID=mkosi
SYSEXT_SCOPE=system
EOF
# The default profiles mount the host's /etc/resolv.conf into our
# image. For that the file to mount over needs to exist. Let's create
# it here.
touch /etc/resolv.conf

View File

@ -0,0 +1,21 @@
#!/bin/sh
set -eu
DIRS="etc dev proc run sys tmp usr/lib var/tmp"
for dir in $DIRS
do
mkdir -p "$DESTDIR/$dir"
done
touch "$DESTDIR/etc/machine-id"
touch "$DESTDIR/etc/resolv.conf"
cat <<EOF >"$DESTDIR/usr/lib/os-release"
ID=arch
SYSEXT_ID="$IMAGE_ID"
SYSEXT_VERSION_ID="$IMAGE_VERSION"
SYSEXT_SCOPE=portable
PORTABLE_PRETTY_NAME="OpenSSH SSH daemon"
PORTABLE_PREFIXES=sshd
EOF

View File

@ -2,9 +2,11 @@
Dependencies=base
[Output]
# See: https://systemd.io/PORTABLE_SERVICES/
Format=portable
Overlay=yes
Output=openssh_%v.portable
ImageId=openssh
Output=%i_%v.%t
SectorSize=4096
# For Reproducible Builds
Seed=834dd70f55be43cc9934b20fc0b7f7be

View File

@ -1,15 +0,0 @@
#!/bin/bash
set -eu
cat >/usr/lib/os-release <<EOF
ID=rafeOS
SYSEXT_ID=openssh
SYSEXT_SCOPE=portable
PORTABLE_PREFIXES=sshd
PORTABLE_PRETTY_NAME="OpenSSH Portable Service"
EOF
# The default profiles mount the host's /etc/resolv.conf into our
# image. For that the file to mount over needs to exist. Let's create
# it here.
touch /etc/resolv.conf