From 06489cbd79adf64493a3cbcc44780f103a83826b Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Sat, 11 Apr 2026 14:08:59 -0700 Subject: [PATCH] main/postmarketos-duranium: add support for systemd config extensions Some of this was inspired by what GNOME OS does. Signed-off-by: Clayton Craft Part-of: --- main/postmarketos-duranium/APKBUILD | 18 +++++++++++------- .../rootfs-usr-lib-systemd-confext.conf | 2 ++ ...ib-systemd-initrd-preset-80-duranium.preset | 1 + ...ib-systemd-system-initramfs-confext.service | 15 +++++++++++++++ ...stem-systemd-confext.service.d-mutable.conf | 5 +++++ .../rootfs-usr-lib-tmpfiles.d-duranium.conf | 2 ++ .../rootfs-usr-lib-tmpfiles.d-opt.conf | 5 ----- .../rootfs-usr-lib-tmpfiles.d-var.conf | 16 ---------------- 8 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 main/postmarketos-duranium/rootfs-usr-lib-systemd-confext.conf create mode 100644 main/postmarketos-duranium/rootfs-usr-lib-systemd-system-initramfs-confext.service create mode 100644 main/postmarketos-duranium/rootfs-usr-lib-systemd-system-systemd-confext.service.d-mutable.conf create mode 100644 main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-duranium.conf delete mode 100644 main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-opt.conf delete mode 100644 main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-var.conf diff --git a/main/postmarketos-duranium/APKBUILD b/main/postmarketos-duranium/APKBUILD index cdc07dcf8..1d31de73d 100644 --- a/main/postmarketos-duranium/APKBUILD +++ b/main/postmarketos-duranium/APKBUILD @@ -1,6 +1,6 @@ maintainer="Clayton Craft " pkgname=postmarketos-duranium -pkgver=1 +pkgver=2 pkgrel=0 pkgdesc="Configuration files for building and booting immutable postmarketOS images" url="https://wiki.postmarketos.org/wiki/Duranium_(Immutable_postmarketOS)" @@ -13,7 +13,6 @@ depends=" # x86: f0rmz arch="noarch !x86" license="GPL-3.0-or-later" -replaces="systemd" # For overwriting tmpfiles.d/{opt,var}.conf subpackages="$pkgname-initramfs" _source644=" @@ -27,15 +26,18 @@ _source644=" usr/lib/repart.d/21-usr-verity.conf usr/lib/repart.d/22-usr.conf usr/lib/repart.d/30-root.conf + usr/lib/systemd/confext.conf usr/lib/systemd/initrd-preset/80-duranium.preset usr/lib/systemd/system-preset/80-duranium.preset usr/lib/systemd/system/duranium-firstboot.service usr/lib/systemd/system/getty@.service.d/wait-firstboot.conf usr/lib/systemd/system/initramfs-buffyboard.service + usr/lib/systemd/system/initramfs-confext.service usr/lib/systemd/system/initramfs-telnetd.service usr/lib/systemd/system/initramfs-unudhcpd.service usr/lib/systemd/system/initramfs-usb-gadget.service usr/lib/systemd/system/mount-subpartitions.service + usr/lib/systemd/system/systemd-confext.service.d/mutable.conf usr/lib/systemd/system/systemd-cryptsetup@.service.d/factory-reset-ordering.conf usr/lib/systemd/system/unl0kr-agent.path.d/plymouth-handoff.conf usr/lib/systemd/system/unl0kr-agent.service.d/conflicts-console.conf @@ -45,8 +47,7 @@ _source644=" usr/lib/sysupdate.d/12-usr.transfer usr/lib/sysupdate.d/20-uki.transfer usr/lib/sysusers.d/10-pmos-user.conf - usr/lib/tmpfiles.d/opt.conf - usr/lib/tmpfiles.d/var.conf + usr/lib/tmpfiles.d/duranium.conf usr/lib/udev/rules.d/90-udisks-ignore-verity-hack.rules usr/share/duranium/f0rmz-firstboot.conf " @@ -106,6 +107,7 @@ initramfs() { amove usr/lib/systemd/system/initramfs-telnetd.service amove usr/lib/systemd/system/initramfs-unudhcpd.service amove usr/lib/systemd/system/initramfs-usb-gadget.service + amove usr/lib/systemd/system/initramfs-confext.service amove usr/lib/systemd/system/mount-subpartitions.service amove usr/lib/systemd/system/systemd-cryptsetup@.service.d/factory-reset-ordering.conf amove usr/lib/systemd/system/unl0kr-agent.path.d/plymouth-handoff.conf @@ -136,15 +138,18 @@ f5688dbd32ae55ea19f5cafff614f2cfc775c1c7078191d4081b254ed25dad58ac5bed0084e5e07a 730aa98894ec4586d5a97b2faed5ec30ae6679b9ebf4e6dd7e1d4f039279691040232ba30d0f88b4a2696131618b17753d0d8262b88d4ff6f1f120cbd0d22acd rootfs-usr-lib-repart.d-21-usr-verity.conf d88e87fb22b8efdc2617e8a3d52102032ce2b0dbde0e7d40a8d7679f507acc9cea271faa7004f96611631dfa0351cd5175dc1574f907176c9e4ebc5561b9a6d6 rootfs-usr-lib-repart.d-22-usr.conf 84036b008042766e89bc02ecb7d77b52f80973a385a21faa1fbb2348ff0c216c302e29bd52c6cb40e5e547ad58aa955e06a9e94bd2ca0c512903a200f44c9a63 rootfs-usr-lib-repart.d-30-root.conf -65437794433fea0842a5ac7a528f3416d06e21bb85e796279ef6280f225e97b8836685b5a034fd0cd01db0134a74f23131bcc32bb8c386cc8c5fd80febaefaa1 rootfs-usr-lib-systemd-initrd-preset-80-duranium.preset +16984590f17c25be2f45444d8035c8c3a9035e3f52219a3e57e5bab93325acf0fdd50e03cd8a99da44c2adf4fd6234da73de63393582bff456bb128501da6211 rootfs-usr-lib-systemd-confext.conf +5125928c8267306a62c1a7756001dbfb0251ea1a6765cb662c7a2a768a139ce5285f8dfe4ac1ae3ccb4ac34fb8dbe9bce7f98a2ef42e5be1d83be40cee2d87f0 rootfs-usr-lib-systemd-initrd-preset-80-duranium.preset ee8a7a857bb409c7abe55bfaae1bc1cfb7e08f80b1ae22c804f6c012e643c090bfb2a11692e8bb633bd1685f3fd8a0a4789cb67d286fd9d6420032a2285854cd rootfs-usr-lib-systemd-system-preset-80-duranium.preset 09dd75ce4d6790af5156fadea0b948b13a5f36ab1162c45b4a58a5c6b4061d6871610cc3384252422b28bfd7836b95cd7ca857277113abacc0083ecdd6cfff1f rootfs-usr-lib-systemd-system-duranium-firstboot.service 16fc787401e1fbbd1421257781270d2be6cb879ab9cc99412044df25af72c5525567f7b7f1066f022c0b7e03dd33c62f2d871fed9e9121ed309564c207795c38 rootfs-usr-lib-systemd-system-getty@.service.d-wait-firstboot.conf 786a057e3f1eab37773b5255a5abde060b6bc6f42fd2cdaa82ce678263db6177ca30b49decb795293a4a0ccaf02346684acd0469cc8222898c43768376f2218d rootfs-usr-lib-systemd-system-initramfs-buffyboard.service +ef4bd401dd86ff0a56362b6441f01a1aa9c3612bcb4fe53c024365cf1c99c2614f1221b0ca2caf231970f4e48bf320d86667dca7caae39d3c40c27b3741adf9c rootfs-usr-lib-systemd-system-initramfs-confext.service 4f303c5d7cb7054e8bb6e109aa3f4337098b19a6b5a8c6b0b1e1033889d8b1f85a87a0086b67f6f9c62fc93aeca0c59e50def12fff33b79fb7819657b5b820ec rootfs-usr-lib-systemd-system-initramfs-telnetd.service 7620e15cebb92c06a662bea095122793b8928b37c8b73fb060f2c882ac9c40419cc3e9eacafab2d04f8089a6fd32c1aa46f9247c54ee60adca87a796262bc37a rootfs-usr-lib-systemd-system-initramfs-unudhcpd.service 9c0eb915c09fc3d8de3a1a486f3e2202be05b11ba924d13349a70d93355ca0c72fe2417504e4b7e0c74aa1bb7f5ae77e3497f09dd67e48c0b8f2432f382f2f38 rootfs-usr-lib-systemd-system-initramfs-usb-gadget.service 221844a2fe5af2c9c675d7d7c118f3db82afbf8b28db77ea049db74813b62881fe40ada30630f5fd777c6503e2936e22251be75e278635274fe6ac08eba8e56b rootfs-usr-lib-systemd-system-mount-subpartitions.service +16c5f02640b527470ee4060dab0a3e0491ff751d631c30f2ce83858c1cf81f0980b687e9473f74fc96185356cb63bcf14008d3891f0c98ac105aee9711cdf9f5 rootfs-usr-lib-systemd-system-systemd-confext.service.d-mutable.conf 101b1af9f26fe57f8be1f0353d8146724aaad4c80e790b85559e0d7ce10a1b9169429b112fc17dafde4902e26617ced00b3540a3999c50b606f3ff7564759464 rootfs-usr-lib-systemd-system-systemd-cryptsetup@.service.d-factory-reset-ordering.conf 612e50282c0ceb7676d8e62853e99bd693103fc59098d8ac91173538ff1c3fa8b69d3eebeaa6390df7c8f9cc62fddae1ca2d35d07d97e60b40b660bc62bf049b rootfs-usr-lib-systemd-system-unl0kr-agent.path.d-plymouth-handoff.conf b1aa826b83fbb5d606b5dc37a4db67a7233519e0ac953325395dd7f3b7e303d206f6297e51a749d07ee173ccbc4ccf055e92888e38345783d4f4c7687a6a9870 rootfs-usr-lib-systemd-system-unl0kr-agent.service.d-conflicts-console.conf @@ -154,8 +159,7 @@ b1aa826b83fbb5d606b5dc37a4db67a7233519e0ac953325395dd7f3b7e303d206f6297e51a749d0 14df73dfc786a249b300f8998b1f51301834cf058b65c95701b1350f112d2c3deed3b8db9ba439bd90537cef533f148d187bd73961707dca12ef84735e2d5595 rootfs-usr-lib-sysupdate.d-12-usr.transfer 4ffb2be01cb033c1282b6661052250937e1ac457cec3900b075d0dcdf59de7dcb2eb927c39db0e96468a90b03fed0a4e6db0d99f62d714c31a29d4684e79751f rootfs-usr-lib-sysupdate.d-20-uki.transfer fa1c3dd727fd20d16d18695d58dd10ec335d64ece00152346c84ae750ed5ade8faf5ba11747135d79972dd1a3f4f1ab496ae9425ebcf7232a4203ca9396fa7e0 rootfs-usr-lib-sysusers.d-10-pmos-user.conf -0779c6d5959aef0e325adb69f3e0720a3f271f474c0f14e9c830f015c923c432d07222a24ce722a3ea58670d2eff3536d45bcaf7ae848b587676f1586a348e0e rootfs-usr-lib-tmpfiles.d-opt.conf -7d98cb314472d7db64599c8abfc2e21ef6437b0c5bf407f0c21a42ec2f14f660fb3aef64c99a13aada124a822a85d8e4a6674838d1fe07719774331121d5414b rootfs-usr-lib-tmpfiles.d-var.conf +fc4bf2b78e25b3f04add2ef7fbcfe70f24f8a865526ea817252a6bc4585755d40873909c4a1eb37acc86f93424f7de0bc2add29265eb2e5df69764ae0018fd76 rootfs-usr-lib-tmpfiles.d-duranium.conf ede57bf8696dce4ee295dc2a1dfe31dec415e7ce994600ce3bf7386ac1ad63797a6c5a88434ca0cc854cdad6618647845126b1f8757c48f83ce308d394b8c68d rootfs-usr-lib-udev-rules.d-90-udisks-ignore-verity-hack.rules 7f2b98edc7b485129ea862c5c852422e8996ffe0a2bdae3160b6c94667b4e345a1792164e3143d58cb1a51c3c6981381ad7610d709aba210bb61a0c883455476 rootfs-usr-share-duranium-f0rmz-firstboot.conf 619368ffc9dd1fd9c0f662c0bb8f407a6514c8b12611511d715f705874e3be24201b5046e631c476bd70d661ca45576df8fb10aa86cf11a7de9a79289b7a7806 rootfs-usr-bin-duranium-set-channel diff --git a/main/postmarketos-duranium/rootfs-usr-lib-systemd-confext.conf b/main/postmarketos-duranium/rootfs-usr-lib-systemd-confext.conf new file mode 100644 index 000000000..445030a55 --- /dev/null +++ b/main/postmarketos-duranium/rootfs-usr-lib-systemd-confext.conf @@ -0,0 +1,2 @@ +[ConfExt] +Mutable=yes diff --git a/main/postmarketos-duranium/rootfs-usr-lib-systemd-initrd-preset-80-duranium.preset b/main/postmarketos-duranium/rootfs-usr-lib-systemd-initrd-preset-80-duranium.preset index c2998833e..28b5d8a74 100644 --- a/main/postmarketos-duranium/rootfs-usr-lib-systemd-initrd-preset-80-duranium.preset +++ b/main/postmarketos-duranium/rootfs-usr-lib-systemd-initrd-preset-80-duranium.preset @@ -2,5 +2,6 @@ enable initramfs-buffyboard.service enable initramfs-telnetd.service enable initramfs-unudhcpd.service enable initramfs-usb-gadget.service +enable initramfs-confext.service enable mount-subpartitions.service enable unl0kr-agent.path diff --git a/main/postmarketos-duranium/rootfs-usr-lib-systemd-system-initramfs-confext.service b/main/postmarketos-duranium/rootfs-usr-lib-systemd-system-initramfs-confext.service new file mode 100644 index 000000000..4a97e3e1d --- /dev/null +++ b/main/postmarketos-duranium/rootfs-usr-lib-systemd-system-initramfs-confext.service @@ -0,0 +1,15 @@ +[Unit] +Description=Merge confext images into sysroot /etc +ConditionPathExists=/etc/initrd-release +ConditionDirectoryNotEmpty=|/sysroot/usr/lib/confexts +ConditionDirectoryNotEmpty=|/sysroot/var/lib/confexts +RequiresMountsFor=/sysroot/usr +After=initrd-root-fs.target +Before=initrd-fs.target initrd-parse-etc.service + +[Service] +Type=oneshot +ExecStart=systemd-confext --mutable=yes --root=/sysroot refresh + +[Install] +WantedBy=initrd.target diff --git a/main/postmarketos-duranium/rootfs-usr-lib-systemd-system-systemd-confext.service.d-mutable.conf b/main/postmarketos-duranium/rootfs-usr-lib-systemd-system-systemd-confext.service.d-mutable.conf new file mode 100644 index 000000000..4a714369a --- /dev/null +++ b/main/postmarketos-duranium/rootfs-usr-lib-systemd-system-systemd-confext.service.d-mutable.conf @@ -0,0 +1,5 @@ +[Service] +ExecStart= +ExecStart=systemd-confext --mutable=yes refresh +ExecReload= +ExecReload=systemd-confext --mutable=yes refresh diff --git a/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-duranium.conf b/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-duranium.conf new file mode 100644 index 000000000..9bcaa7ca7 --- /dev/null +++ b/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-duranium.conf @@ -0,0 +1,2 @@ +# openssh expects this dir to exist +d /var/empty 0755 root root - diff --git a/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-opt.conf b/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-opt.conf deleted file mode 100644 index 00112d3ac..000000000 --- a/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-opt.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Populate /opt from factory defaults -# The 'C' directive copies if destination doesn't exist (works since /opt is empty on first boot) - -# Copy entire /opt structure from factory on first boot -C /opt - - - - /usr/share/factory/opt diff --git a/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-var.conf b/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-var.conf deleted file mode 100644 index 03e486470..000000000 --- a/main/postmarketos-duranium/rootfs-usr-lib-tmpfiles.d-var.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Populate /var from factory defaults -# The 'C' directive copies if destination doesn't exist (works since /var is empty on first boot) - -# Copy entire /var structure from factory on first boot -C+ /var - - - - /usr/share/factory/var - -# Additional runtime directories that may not exist in factory -d /var/run 0755 root root - -L /run - - - - /var/run - -# Ensure critical runtime directories exist -d /var/log/journal 2755 root systemd-journal - -d /var/log/journal/%m 2755 root systemd-journal - -d /var/tmp 1777 root root - -d /var/cache 0755 root root - -d /var/lib 0755 root root -