1
0
mirror of synced 2025-01-30 20:11:45 +03:00

Improve eth0 detection

This commit is contained in:
hwdsl2 2016-06-10 22:05:26 -05:00
parent 8a75d02751
commit deb2f75eb9
2 changed files with 4 additions and 2 deletions

View File

@ -53,7 +53,8 @@ if [ "$(id -u)" != 0 ]; then
exit 1
fi
if [ ! -f /sys/class/net/eth0/operstate ]; then
eth0_state=$(cat /sys/class/net/eth0/operstate 2>/dev/null)
if [ -z "$eth0_state" ] || [ "$eth0_state" = "down" ]; then
cat 1>&2 <<'EOF'
Network interface 'eth0' is not available. Aborting.

View File

@ -57,7 +57,8 @@ if [ "$(id -u)" != 0 ]; then
exit 1
fi
if [ ! -f /sys/class/net/eth0/operstate ]; then
eth0_state=$(cat /sys/class/net/eth0/operstate 2>/dev/null)
if [ -z "$eth0_state" ] || [ "$eth0_state" = "down" ]; then
cat 1>&2 <<'EOF'
Network interface 'eth0' is not available. Aborting.