gentoo: 修复重启后网卡未被 networkd 接管

This commit is contained in:
bin456789 2023-11-04 12:44:07 +08:00
parent 8dfdce23e3
commit f845c19a8f
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -1089,6 +1089,13 @@ modify_linux() {
# 临时的解决办法是运行 networkctl如果启用了systemd-networkd服务会运行服务
insert_into_file $os_dir/lib/systemd/system/systemd-logind.service after '\[Service\]' <<EOF
ExecStartPost=-networkctl
EOF
# 如果创建了 cloud-init.disabled重启后网络不受 networkd 管理
# 因为网卡名变回了 ens3 而不是 eth0
# 因此要删除 networkd 的网卡名匹配
insert_into_file $ci_file after '^runcmd:' <<EOF
- sed -i '/^Name=/d' /etc/systemd/network/10-cloud-init-eth*.network
EOF
fi
}