]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Store /etc under /usr/share/factory/mkosi
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 9 May 2023 11:47:43 +0000 (13:47 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 13 May 2023 07:17:15 +0000 (09:17 +0200)
If we're making a /usr only image, we still want to populate /etc
fully on first boot. To make that possible, let's copy /etc to
/usr/share/factory/mkosi in a finalize script, which runs after
all changes to the image have been made. Let's also add a tmpfiles
snippet that merges /usr/share/factory/mkosi with /etc on boot to
populate /etc.

mkosi.presets/20-final/mkosi.extra/usr/lib/tmpfiles.d/99-mkosi.conf [new file with mode: 0644]
mkosi.presets/20-final/mkosi.finalize [new file with mode: 0755]

diff --git a/mkosi.presets/20-final/mkosi.extra/usr/lib/tmpfiles.d/99-mkosi.conf b/mkosi.presets/20-final/mkosi.extra/usr/lib/tmpfiles.d/99-mkosi.conf
new file mode 100644 (file)
index 0000000..dac79ba
--- /dev/null
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+C+! /etc - - - - /usr/share/factory/mkosi
diff --git a/mkosi.presets/20-final/mkosi.finalize b/mkosi.presets/20-final/mkosi.finalize
new file mode 100755 (executable)
index 0000000..74b810c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+cp --archive --recursive --no-target-directory --reflink=auto "$BUILDROOT"/etc "$BUILDROOT"/usr/share/factory/mkosi