summaryrefslogtreecommitdiff
path: root/mkosi.presets
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-09 13:47:43 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-13 09:17:15 +0200
commit724683c27fd35e4828e35320ccfc62f885ca20bc (patch)
treef16339499f0123bae8daee5994321db44e58dad6 /mkosi.presets
parent79255d86ba79bd848ef6bf44ba0452c5bf8e77c1 (diff)
downloadsystemd-724683c27fd35e4828e35320ccfc62f885ca20bc.tar.gz
mkosi: Store /etc under /usr/share/factory/mkosi
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.
Diffstat (limited to 'mkosi.presets')
-rw-r--r--mkosi.presets/20-final/mkosi.extra/usr/lib/tmpfiles.d/99-mkosi.conf3
-rwxr-xr-xmkosi.presets/20-final/mkosi.finalize4
2 files changed, 7 insertions, 0 deletions
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
index 0000000000..dac79ba4ed
--- /dev/null
+++ b/mkosi.presets/20-final/mkosi.extra/usr/lib/tmpfiles.d/99-mkosi.conf
@@ -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
index 0000000000..74b810c152
--- /dev/null
+++ b/mkosi.presets/20-final/mkosi.finalize
@@ -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