From 48b4dd5a0b77479b1fc9649c8803cb4d935af26c Mon Sep 17 00:00:00 2001 From: bin456789 Date: Thu, 6 Feb 2025 18:47:22 +0800 Subject: [PATCH] =?UTF-8?q?debian=2011:=20=E4=BF=AE=E5=A4=8D=20allow-hotpl?= =?UTF-8?q?ug=20=E5=AF=BC=E8=87=B4=E9=87=8D=E5=90=AF=20networking=20?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=97=B6=E7=BD=91=E5=8D=A1=E8=A2=AB=E5=85=B3?= =?UTF-8?q?=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trans.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/trans.sh b/trans.sh index ebd0e26..e13b802 100644 --- a/trans.sh +++ b/trans.sh @@ -892,9 +892,21 @@ EOF # ethx for ethx in $(get_eths); do mode=auto - if is_distro_like_debian; then - if [ -f /etc/network/devhotplug ] && grep -wo "$ethx" /etc/network/devhotplug; then - mode=allow-hotplug + # shellcheck disable=SC2154 + if false; then + if { [ "$distro" = debian ] && [ "$releasever" -ge 12 ]; } || + [ "$distro" = kali ]; then + # alice + allow-hotplug 会有问题 + # 问题 1 debian 9/10/11/12: + # 如果首次启动时,/etc/networking/interfaces 的 ethx 跟安装时不同 + # 即使启动 networking 服务前成功执行了 fix-eth-name.sh ,网卡也不会启动 + # 测试方法: 安装时手动修改 /etc/networking/interfaces enp3s0 为其他名字 + # 问题 2 debian 9/10/11: + # 重启系统后会自动启动网卡,但运行 systemctl restart networking 会关闭网卡 + # 可能的原因: /lib/systemd/system/networking.service 没有 hotplug 相关内容,而 debian 12+ 有 + if [ -f /etc/network/devhotplug ] && grep -wo "$ethx" /etc/network/devhotplug; then + mode=allow-hotplug + fi fi # if is_have_cmd udevadm; then