summaryrefslogtreecommitdiff
path: root/osi-mk.d/systemd-dhcpcd.sh
blob: add835223685c4a8fb520801dc4a9590377f89d3 (plain)
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
#!/hint/bash -euE

# Also enable haveged.  Without it, TLS will be unavailable for a
# while even after network-online.target because getrandom(2) will
# block for so long that the connection will time out.

packages+=('haveged')

post_install+=(10:dhcpcd:post_install)
dhcpcd:post_install() {
	local arg_mountpoint=$1

	cat <<-'EOT' > "${arg_mountpoint}/etc/udev/rules.d/81-dhcpcd.rules"
		ACTION=="add", SUBSYSTEM=="net", ENV{SYSTEMD_WANTS}="dhcpcd@$name.service"
		EOT
	mkdir "${arg_mountpoint}/etc/systemd/system/dhcpcd@.service.d"
	cat <<-'EOT' > "${arg_mountpoint}/etc/systemd/system/dhcpcd@.service.d/wait-online.conf"
		[Unit]
		Before=network-online.target
		EOT
	mkdir "${arg_mountpoint}/etc/systemd/system/network-online.target.d"
	cat <<-'EOT' > "${arg_mountpoint}/etc/systemd/system/network-online.target.d/udev-settle.conf"
		[Unit]
		Wants=systemd-udev-settle.service
		After=systemd-udev-settle.service
		EOT

	systemctl --root="$arg_mountpoint" enable haveged.service
}