1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-18 10:04:04 +03:00

mkosi: Build a sysext if SYSEXT=1 is specified

This commit is contained in:
Daan De Meyer 2024-07-10 10:07:05 +02:00
parent ece66c01cf
commit 612a98a065
5 changed files with 59 additions and 1 deletions

View File

@ -140,6 +140,7 @@ jobs:
SANITIZERS=${{ matrix.sanitizers }}
MESON_OPTIONS=--werror
LLVM=${{ matrix.llvm }}
SYSEXT=1
[Host]
QemuMem=4G

View File

@ -2,4 +2,4 @@
set -e
set -o nounset
rm -f "$OUTPUTDIR"/*.{rpm,deb,pkg.tar}
rm -f "$OUTPUTDIR"/*.{rpm,deb,pkg.tar} "$OUTPUTDIR"/systemd.raw

View File

@ -2,6 +2,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
. mkosi.functions
if ((NO_BUILD)); then
exit 0
fi
@ -120,3 +122,5 @@ CXX_LD="$( ((LLVM)) && echo lld)" \
cp "$OUTPUTDIR"/*.rpm "$PACKAGEDIR"
cp "$OUTPUTDIR"/*.rpm "$BUILDDIR"
make_sysext_unsigned /var/tmp/BUILD/*/BUILDROOT

View File

@ -2,6 +2,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
. mkosi.functions
if ((NO_BUILD)); then
exit 0
fi
@ -139,3 +141,5 @@ fi
cp "$OUTPUTDIR"/*.rpm "$PACKAGEDIR"
cp "$OUTPUTDIR"/*.rpm "$BUILDDIR"
make_sysext_unsigned /var/tmp/BUILD/*/BUILDROOT

49
mkosi.functions Normal file
View File

@ -0,0 +1,49 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
make_sysext_unsigned() {
if ! ((SYSEXT)); then
return
fi
mkdir -p /usr/lib/systemd/repart/definitions/sysext-unsigned.repart.d
cat >/usr/lib/systemd/repart/definitions/sysext-unsigned.repart.d/10-root.conf <<EOF
[Partition]
Type=root
Format=erofs
CopyFiles=/usr/
Minimize=best
EOF
. /usr/lib/os-release
mkdir -p "$1"/usr/lib/extension-release.d
cat >"$1"/usr/lib/extension-release.d/extension-release.systemd <<EOF
ID=$ID
SYSEXT_ID=systemd
SYSEXT_SCOPE=system
ARCHITECTURE=$ARCHITECTURE
EOF
if [[ -n "$VERSION_ID" ]]; then
cat >>"$1"/usr/lib/extension-release.d/extension-release.systemd <<EOF
VERSION_ID=$VERSION_ID
EOF
fi
if [[ -n "$SYSEXT_LEVEL" ]]; then
cat >>"$1"/usr/lib/extension-release.d/extension-release.systemd <<EOF
SYSEXT_LEVEL=$SYSEXT_LEVEL
EOF
fi
rm -f "$BUILDDIR"/systemd.raw
env --unset=SYSTEMD_REPART_OVERRIDE_FSTYPE_ROOT \
"$BUILDDIR"/systemd-repart \
--make-ddi=sysext-unsigned \
--copy-source="$1" \
--pretty=no \
"$BUILDDIR"/systemd.raw
cp "$BUILDDIR"/systemd.raw "$OUTPUTDIR"
}