osi-tools/mkosi.d/systemd-dhcpcd.sh

22 lines
707 B
Bash

#!/hint/bash
post_install+=(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
}