-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathinitrd-network.service
53 lines (40 loc) · 1.8 KB
/
initrd-network.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
# Configure networks in the initramfs
[Unit]
Description=Initrd Network Service
Documentation=https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
ConditionPathExists=/etc/initrd-release
DefaultDependencies=no
Before=cryptsetup-pre.target
Requires=systemd-networkd.service
Requires=systemd-resolved.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
#### required to recover from emergency service
ExecStart=/bin/sh -c "echo '%N: enable network devices'"
ExecStart=/bin/sh -c "for dev in $(ls /sys/class/net) ; do ip link set $dev up ; done"
#### required for interface renaming after switch-root
ExecStop=/bin/sh -c "echo '%N: disable network devices'"
ExecStop=/bin/sh -c "for dev in $(ls /sys/class/net) ; do ip addr flush $dev ; done"
ExecStop=/bin/sh -c "for dev in $(ls /sys/class/net) ; do ip link set $dev down ; done"
[Install]
WantedBy=sysinit.target
[X-SystemdTool]
# TODO use predictable network interface names
#InitrdPath=/usr/lib/udev/rules.d/80-net-setup-link.rules
# include network activated in initramfs
InitrdPath=/etc/systemd/network/initrd-network.network source=/etc/mkinitcpio-systemd-tool/network/initrd-network.network
# provision discovered network kernel modules
InitrdCall=add_checked_modules /drivers/net/
# runtime location of resolv.conf provided by systemd-resolved.service
InitrdLink=/etc/resolv.conf target=/run/systemd/resolve/resolv.conf
# ensure consistent host name
InitrdPath=/etc/hostname replace=yes optional=yes
# include default config file for systemd-resolved.service
InitrdPath=/usr/lib/systemd/resolv.conf
# dns resolution support
InitrdBinary=/usr/lib/libnss_dns.so.2 optional=yes
# required for systemd-resolved
InitrdPath=/var/tmp/ create=yes