script/ethercat.sh
changeset 321 64e20e6e9d0b
parent 299 911f0aed65a9
child 323 d8ac7b1d260e
equal deleted inserted replaced
320:71d559ec66d7 321:64e20e6e9d0b
    63 #  Function for setting up the EoE bridge
    63 #  Function for setting up the EoE bridge
    64 #
    64 #
    65 build_eoe_bridge() {
    65 build_eoe_bridge() {
    66         if [ -z "$EOE_BRIDGE" ]; then return; fi
    66         if [ -z "$EOE_BRIDGE" ]; then return; fi
    67 
    67 
    68 	EOE_INTERFACES=`/sbin/ifconfig -a | grep -o -E "^eoe[0-9]+ "`
    68 	EOEIF=`/sbin/ifconfig -a | grep -o -E "^eoe[0-9]+ "`
    69 
    69 
    70 	# add bridge, if it does not already exist
    70 	# add bridge, if it does not already exist
    71 	if ! /sbin/brctl show | grep -E -q "^$EOE_BRIDGE"; then
    71 	if ! /sbin/brctl show | grep -E -q "^$EOE_BRIDGE"; then
    72 	        if ! /sbin/brctl addbr $EOE_BRIDGE; then
    72 	        if ! /sbin/brctl addbr $EOE_BRIDGE; then
    73 		        /bin/false
    73 		        /bin/false
    74 			rc_status -v
    74 			rc_status -v
    75 			rc_exit
    75 			rc_exit
    76 		fi
    76 		fi
    77 	fi
    77 	fi
    78 
    78 
    79        	# check if specified interfaces are bridged
    79     # check if specified interfaces are bridged
    80 	for interf in $EOE_INTERFACES $EOE_EXTRA_INTERFACES; do
    80 	for interf in $EOEIF $EOE_EXTRA_INTERFACES; do
    81 	        # interface is already part of the bridge 
    81 	        # interface is already part of the bridge 
    82 	        if /sbin/brctl show $EOE_BRIDGE | grep -E -q $interf
    82 	        if /sbin/brctl show $EOE_BRIDGE | grep -E -q $interf
    83 		        then continue
    83 		        then continue
    84 		fi
    84 		fi
    85 		# clear IP address and open interface
    85 		# clear IP address and open interface
   145 	    /bin/false
   145 	    /bin/false
   146 	    rc_status -v
   146 	    rc_status -v
   147 	    rc_exit
   147 	    rc_exit
   148 	fi
   148 	fi
   149 
   149 
   150 	if [ -z "$EOE_DEVICES" ]; then
   150 	if [ -z "$EOE_INTERFACES" ]; then
   151 	    EOE_DEVICES=0
   151 		if [ -n "$EOE_DEVICES"]; then # support legacy sysconfig files
       
   152 			EOE_INTERFACES=$EOE_DEVICES
       
   153 		else
       
   154 			EOE_INTERFACES=0
       
   155 		fi
   152 	fi
   156 	fi
   153 
   157 
   154 	# unload conflicting modules at first
   158 	# unload conflicting modules at first
   155 	for mod in 8139too 8139cp; do
   159 	for mod in 8139too 8139cp; do
   156 		if lsmod | grep "^$mod " > /dev/null; then
   160 		if lsmod | grep "^$mod " > /dev/null; then
   161 			fi
   165 			fi
   162 		fi
   166 		fi
   163 	done
   167 	done
   164 
   168 
   165 	# load master module
   169 	# load master module
   166 	if ! modprobe ec_master ec_eoe_devices=$EOE_DEVICES; then
   170 	if ! modprobe ec_master ec_eoeif_count=$EOE_INTERFACES; then
   167 	    /bin/false
   171 	    /bin/false
   168 	    rc_status -v
   172 	    rc_status -v
   169 	    rc_exit
   173 	    rc_exit
   170 	fi
   174 	fi
   171 
   175