From a456f5191f6c754379a19ae57fcfc07a5401091f Mon Sep 17 00:00:00 2001 From: gobo72 Date: Sat, 5 Mar 2011 20:24:31 +0000 Subject: [PATCH] =?utf8?q?V=C3=A9rification=20si=20interface=20r=C3=A9seau?= =?utf8?q?=20existe=20avant=20de=20l'activer/d=C3=A9sactiver?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- stage2/bootscripts/ifdown | 6 ++++++ stage2/bootscripts/ifup | 6 ++++++ stage2/bootscripts/network | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/stage2/bootscripts/ifdown b/stage2/bootscripts/ifdown index 52a20df..115c488 100755 --- a/stage2/bootscripts/ifdown +++ b/stage2/bootscripts/ifdown @@ -23,6 +23,12 @@ check_brctl() fi } +# First make sure interface is available +if ! ip link show ${DEVICE} ; then + echo "Interface ${DEVICE} not available" + exit ${EXIT_CODE_WARNING} +fi + if [ "x${BOOTPROTO}" = "xdhcp" ]; then # DHCP configuration diff --git a/stage2/bootscripts/ifup b/stage2/bootscripts/ifup index 4224c47..b8fc5e8 100755 --- a/stage2/bootscripts/ifup +++ b/stage2/bootscripts/ifup @@ -23,6 +23,12 @@ check_brctl() fi } +# First make sure interface is available +if ! ip link show ${DEVICE} ; then + echo "Interface ${DEVICE} not available" + exit ${EXIT_CODE_WARNING} +fi + # Determining if the interface is a bridge: if [ "x${BRIDGE}" = "xyes" ]; then check_brctl diff --git a/stage2/bootscripts/network b/stage2/bootscripts/network index f42ea1f..70ac088 100755 --- a/stage2/bootscripts/network +++ b/stage2/bootscripts/network @@ -28,7 +28,7 @@ case "$1" in start) for i in ${INTERFACES_UP}; do if LANG=C egrep -L "^ONBOOT=\"?[Yy][Ee][Ss]\"?" ifconfig.$i >/dev/null 2>&1 ; then - cmd_run_log_box "Ethernet Adapter <$i> init" /etc/rc.d/init.d/ifup "$i" + cmd_run_log_box_warn "Ethernet Adapter <$i> init" /etc/rc.d/init.d/ifup "$i" fi done ;; @@ -36,7 +36,7 @@ case "$1" in stop) for i in ${INTERFACES_DN} ; do if LC_ALL= LANG= ip link show dev $i 2> /dev/null | grep -q "UP" >/dev/null 2>&1 ; then - cmd_run_log_box "Ethernet Adapter <$i> stop" /etc/rc.d/init.d/ifdown "$i" + cmd_run_log_box_warn "Ethernet Adapter <$i> stop" /etc/rc.d/init.d/ifdown "$i" fi done ;; -- 2.20.1