Skip to content

Commit 3fe5c02

Browse files
authored
Merge pull request #3766 from aafeijoo-suse/initrd-profiles-network-nfs
Add "nfs" (and "network") initrd profiles
2 parents 184472f + ecebb1f commit 3fe5c02

File tree

15 files changed

+91
-1
lines changed

15 files changed

+91
-1
lines changed

mkosi/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ def default(cls) -> tuple["ToolsTreeProfile", ...]:
639639

640640
class InitrdProfile(StrEnum):
641641
lvm = enum.auto()
642+
network = enum.auto()
643+
nfs = enum.auto()
642644
pkcs11 = enum.auto()
643645
plymouth = enum.auto()
644646
raid = enum.auto()

mkosi/initrd.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,24 @@ def process_crypttab(staging_dir: Path) -> list[str]:
196196
return cmdline
197197

198198

199+
def network_config() -> list[str]:
200+
return [
201+
f"--extra-tree={f}:{f}"
202+
for f in (
203+
"/etc/systemd/network",
204+
"/etc/systemd/networkd.conf",
205+
"/etc/systemd/networkd.conf.d",
206+
"/etc/systemd/resolved.conf",
207+
"/etc/systemd/resolved.conf.d",
208+
)
209+
if Path(f).exists()
210+
]
211+
212+
213+
def nfs_config() -> list[str]:
214+
return [f"--extra-tree={f}:{f}" for f in ("/etc/idmapd.conf", "/etc/idmapd.conf.d") if Path(f).exists()]
215+
216+
199217
def raid_config() -> list[str]:
200218
return [
201219
f"--extra-tree={f}:{f}"
@@ -333,7 +351,11 @@ def main() -> None:
333351

334352
for p in args.profile:
335353
cmdline += ["--profile", p]
336-
if p == "raid":
354+
if p == "network":
355+
cmdline += network_config()
356+
elif p == "nfs":
357+
cmdline += nfs_config()
358+
elif p == "raid":
337359
cmdline += raid_config()
338360

339361
if args.kernel_image:

mkosi/resources/man/mkosi-initrd.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ initrds and Unified Kernel Images for the current running system.
4545
disabled.
4646

4747
The `lvm` profile enables support for LVM.
48+
The `network` profile enables support for network via **systemd-networkd**.
49+
The `nfs` profile enables support for NFS. It requires networking in the
50+
initrd, using the `network` profile, or some other custom method.
4851
The `pkcs11` profile enables support for PKCS#11.
4952
The `plymouth` profile provides a graphical interface at boot (animation and
5053
password prompt).

mkosi/resources/man/mkosi.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,9 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
10531053
disabled.
10541054

10551055
The `lvm` profile enables support for LVM.
1056+
The `network` profile enables support for network via **systemd-networkd**.
1057+
The `nfs` profile enables support for NFS. It requires networking in the
1058+
initrd, using the `network` profile, or some other custom method.
10561059
The `pkcs11` profile enables support for PKCS#11.
10571060
The `plymouth` profile provides a graphical interface at boot (animation and
10581061
password prompt).

mkosi/resources/mkosi-initrd/mkosi.conf.d/10-arch.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Packages=
1414
libfido2
1515
tpm2-tss
1616

17+
procps-ng
1718
util-linux
1819

1920
RemoveFiles=

mkosi/resources/mkosi-initrd/mkosi.conf.d/10-azure-centos-fedora.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ Packages=
1717
e2fsprogs
1818
xfsprogs
1919
dosfstools
20+
21+
procps-ng

mkosi/resources/mkosi-initrd/mkosi.conf.d/10-debian-kali-ubuntu/mkosi.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Packages=
1818
e2fsprogs
1919
dosfstools
2020

21+
procps
2122
util-linux
2223

2324
# Various libraries that are dlopen'ed by systemd

mkosi/resources/mkosi-initrd/mkosi.conf.d/10-opensuse.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Packages=
2727
xfsprogs
2828
dosfstools
2929

30+
procps
3031
util-linux
3132

3233
RemovePackages=
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
3+
[Match]
4+
Distribution=|fedora
5+
Distribution=|opensuse
6+
7+
[Content]
8+
Packages=systemd-networkd
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
3+
[Match]
4+
Distribution=!arch
5+
6+
[Content]
7+
Packages=systemd-resolved

0 commit comments

Comments
 (0)