From 3cb33dba840d8edddc18ac27b9a45b3860022866 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 25 Mar 2008 16:35:24 +0000 Subject: [PATCH] add a check on brctl module when configuring the qemu network --- system/template-qemu/env-qemu | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/system/template-qemu/env-qemu b/system/template-qemu/env-qemu index 6dde002..18b8e72 100755 --- a/system/template-qemu/env-qemu +++ b/system/template-qemu/env-qemu @@ -16,6 +16,7 @@ IP_NETMASK=0.0.0.0 INTERFACE_LAN=eth0 INTERFACE_BRIDGE=br0 +brctl=/usr/sbin/brctl # Fonction de mise en place du pont start () { @@ -89,12 +90,16 @@ start () { IP_NETMASK=$1 fi shift $(($# - 1)) - + #check if the module brctl is there + if [ ! -e $brctl ] ; then + echo "Module Brctl '/usr/sbin/brctl' is not found" + exit 0 + fi # Création et paramétrage du pont echo "Configure $INTERFACE_BRIDGE bridge..." - /usr/sbin/brctl addbr $INTERFACE_BRIDGE + $brctl addbr $INTERFACE_BRIDGE #/usr/sbin/brctl stp $INTERFACE_BRIDGE yes - /usr/sbin/brctl addif $INTERFACE_BRIDGE $INTERFACE_LAN + $brctl addif $INTERFACE_BRIDGE $INTERFACE_LAN echo "Activating promiscuous mode $INTERFACE_LAN..." /sbin/ifconfig $INTERFACE_LAN 0.0.0.0 promisc up sleep 2 @@ -132,9 +137,14 @@ stop () { echo "Attention : pont réseau non trouvé. Vérifier la config réseau ..." exit 1 fi - /usr/sbin/brctl delif $INTERFACE_BRIDGE $INTERFACE_LAN + #check if the module brctl is there + if [ ! -e $brctl ] ;then + echo "Module Brctl '/usr/sbin/brctl' is not found" + exit 0 + fi + $brctl delif $INTERFACE_BRIDGE $INTERFACE_LAN /sbin/ifconfig $INTERFACE_BRIDGE down - /usr/sbin/brctl delbr $INTERFACE_BRIDGE + $brctl delbr $INTERFACE_BRIDGE /sbin/service network restart } @@ -155,7 +165,3 @@ case $1 in esac exit 0 - - - - -- 2.47.0