1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-21 13:34:21 +03:00
systemd/mkosi.functions
Daan De Meyer 7aea1c9e80 mkosi: Move copying packages to the output directory to the postinst script
Now that we have the mkosi.clangd script to run clangd from the mkosi
build script, it becomes clear that doing cleanup with mkosi.clean has
a big gap in that we always run the mkosi.clean script and thus we also
run it when we run the mkosi.clangd script, causing the previously built
packages to be removed when we run clangd without producing new ones.

In mkosi we're improving the situation by only running clean scripts when we
clean up the output directory and disallowing writing to the output directory
from build scripts.

Let's adapt systemd to these changes by moving the copying of packages to the
output directory to the postinst script.
2024-10-29 11:28:47 +01:00

56 lines
1.2 KiB
Plaintext

# 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
local fstype
if command -v mkfs.erofs; then
fstype=erofs
else
fstype=squashfs
fi
env SYSTEMD_REPART_OVERRIDE_FSTYPE_ROOT="$fstype" \
"$BUILDDIR"/systemd-repart \
--make-ddi=sysext-unsigned \
--copy-source="$1" \
--pretty=no \
"$BUILDDIR"/systemd.raw
}