#!/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 }