网口默认up

This commit is contained in:
2026-11-09 10:18:24 +08:00
parent 43b8752560
commit a19e595794
@@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/sh
### BEGIN INIT INFO
# Provides: networking
# Required-Start: mountvirtfs $local_fs
@@ -56,21 +56,25 @@ check_network_swap() {
}
start_eth0_dhcp() {
local retry=0
while [ ! -d /sys/class/net/eth0 ] && [ $retry -lt 10 ]; do
sleep 1
retry=$((retry + 1))
done
[ -d /sys/class/net/eth0 ] || return 0
ip link set eth0 up 2>/dev/null || ifconfig eth0 up 2>/dev/null || true
if command -v udhcpc >/dev/null 2>&1 &&
! ps | grep "[u]dhcpc .*eth0" >/dev/null 2>&1; then
udhcpc -i eth0 -b -R >/dev/null 2>&1 &
fi
# eth0 and netcond are initialized asynchronously on this platform.
# Keep reasserting the link state during late boot so a delayed driver
# probe or netcond cannot leave the interface down. Addressing remains
# dynamic and is handled by udhcpc.
(
retry=0
while [ $retry -lt 60 ]; do
if [ -d /sys/class/net/eth0 ]; then
ip link set eth0 up >/dev/null 2>&1 || \
ifconfig eth0 up >/dev/null 2>&1 || true
if command -v udhcpc >/dev/null 2>&1 &&
! ps | grep "[u]dhcpc .*eth0" >/dev/null 2>&1; then
udhcpc -i eth0 -b -R >/dev/null 2>&1 &
fi
fi
retry=$((retry + 1))
sleep 2
done
) &
}
case "$1" in