mkosi: Unify initrd post-install scripts
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Apr 2024 11:57:48 +0000 (13:57 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 9 Apr 2024 09:57:16 +0000 (11:57 +0200)
Just like we already have $SYSTEMD_PACKAGES for systemd packages to
re-install in the main image, let's add $INITRD_PACKAGES for all
systemd packages to re-install in the initrd.

mkosi.images/system/initrd/mkosi.postinst [new file with mode: 0644]
mkosi.images/system/mkosi.conf
mkosi.images/system/mkosi.conf.d/10-arch/initrd/mkosi.postinst [deleted file]
mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf
mkosi.images/system/mkosi.conf.d/10-centos-fedora/initrd/mkosi.postinst [deleted file]
mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf
mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/initrd/mkosi.postinst [deleted file]
mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf
mkosi.images/system/mkosi.conf.d/10-opensuse/initrd/mkosi.postinst [deleted file]
mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf

diff --git a/mkosi.images/system/initrd/mkosi.postinst b/mkosi.images/system/initrd/mkosi.postinst
new file mode 100644 (file)
index 0000000..b92bb8a
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -e
+
+# shellcheck disable=SC2086
+mkosi-install $INITRD_PACKAGES
+
+# OpenSUSE insists on blacklisting erofs by default because its supposedly a legacy filesystem.
+# See https://github.com/openSUSE/suse-module-tools/pull/71
+rm -f "$BUILDROOT/usr/lib/modprobe.d/60-blacklist_fs-erofs.conf"
index 303af4acb1b345166bbb02bc7f89f809fc1ab1b9..7aa64c4e0e50921aa2001b1019e50e468d7ec074 100644 (file)
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
+[Config]
+InitrdInclude=initrd/
+
 [Output]
 @Format=directory
 
diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/initrd/mkosi.postinst b/mkosi.images/system/mkosi.conf.d/10-arch/initrd/mkosi.postinst
deleted file mode 100755 (executable)
index ad4fe6e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: LGPL-2.1-or-later
-set -e
-
-mkosi-install systemd systemd-sysvcompat
index 06dec482d25f74822cc97831cc9878d4a49dc5b9..457cf6e71f44e95e0cad4e4ff4b4800e31b27898 100644 (file)
@@ -3,14 +3,12 @@
 [Match]
 Distribution=arch
 
-[Config]
-InitrdInclude=initrd/
-
 # TODO: Switch to https://gitlab.archlinux.org/archlinux/packaging/packages/systemd once
 # https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/merge_requests/8 is merged.
 [Content]
 Environment=
         SYSTEMD_PACKAGES="systemd systemd-ukify systemd-sysvcompat systemd-resolvconf systemd-tests"
+        INITRD_PACKAGES="systemd systemd-sysvcompat"
 
 Packages=
         bpf
diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/initrd/mkosi.postinst b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/initrd/mkosi.postinst
deleted file mode 100755 (executable)
index 0b7a4cb..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: LGPL-2.1-or-later
-set -e
-
-mkosi-install systemd systemd-udev
index c556aa84592fa72b4d77583db1eb04e134b992a8..277d17d25ceb618f640544cee8f856547150f0ba 100644 (file)
@@ -4,9 +4,6 @@
 Distribution=|centos
 Distribution=|fedora
 
-[Config]
-InitrdInclude=initrd/
-
 [Content]
 Environment=
         SYSTEMD_PACKAGES="systemd
@@ -22,6 +19,8 @@ Environment=
                           systemd-oomd-defaults
                           systemd-journal-remote
                           systemd-networkd-defaults"
+        INITRD_PACKAGES="systemd systemd-udev"
+
 Packages=
         bpftool
         cryptsetup
diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/initrd/mkosi.postinst b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/initrd/mkosi.postinst
deleted file mode 100755 (executable)
index 640cdb1..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: LGPL-2.1-or-later
-set -e
-
-mkosi-install systemd udev
index 9e5ed1e4b4062d6fe9ac15c445604062985f0690..b6f7fdd926b6f3b14d4d6fa59a4440b4c0f0c364 100644 (file)
@@ -4,9 +4,6 @@
 Distribution=|debian
 Distribution=|ubuntu
 
-[Config]
-InitrdInclude=initrd/
-
 [Content]
 Environment=
         SYSTEMD_PACKAGES="systemd
@@ -23,6 +20,7 @@ Environment=
                           systemd-boot
                           systemd-ukify
                           udev"
+        INITRD_PACKAGES="systemd udev"
 
 Packages=
         ^libasan[0-9]+$
diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/initrd/mkosi.postinst b/mkosi.images/system/mkosi.conf.d/10-opensuse/initrd/mkosi.postinst
deleted file mode 100755 (executable)
index 562bebe..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: LGPL-2.1-or-later
-set -e
-
-# OpenSUSE insists on blacklisting erofs by default because its supposedly a legacy filesystem.
-# See https://github.com/openSUSE/suse-module-tools/pull/71
-rm -f "$BUILDROOT/usr/lib/modprobe.d/60-blacklist_fs-erofs.conf"
-
-mkosi-install systemd udev systemd-experimental
index b9cb0a5179cd3b2dc2a40127876b2c53b5472519..5d04718ef5a9adfb232566bcb7919d463e2a7b01 100644 (file)
@@ -3,9 +3,6 @@
 [Match]
 Distribution=opensuse
 
-[Config]
-InitrdInclude=initrd/
-
 [Content]
 Environment=
         SYSTEMD_PACKAGES="systemd
@@ -18,6 +15,7 @@ Environment=
                           systemd-portable
                           systemd-sysvcompat
                           systemd-testsuite"
+        INITRD_PACKAGES="systemd udev systemd-experimental"
 
 # We install gawk, gzip, grep, xz, sed, rsync and docbook-xsl-stylesheets here explicitly so that the busybox
 # versions don't get installed instead.