source: clfs-embedded/bootscripts/clfs/rc.d/init.d/bridge@ c05e923

Last change on this file since c05e923 was 0ca640d, checked in by Maarten Lankhorst <mlankhorst@…>, 15 years ago

bootscripts: Always bring up bridge interfaces

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/ash
2#
3# Network interface(s) init script
4#
5# config: /etc/network.conf
6# /etc/network.d/interface.[devname]
7
8. /etc/rc.d/init.d/functions
9. /etc/network.conf
10
11if [ "$NETWORKING" != "yes" ] || [ "${BRIDGE_INTERFACES}" = "" ]; then
12 exit 0
13fi
14
15if [ ! -x /usr/sbin/brctl ]; then
16 echo -n "Setting up bridge: /usr/sbin/brctl not found "
17 false
18 check_status
19fi
20
21case "$1" in
22start)
23 echo -n "Adding bridge br0: "
24 brctl addbr br0
25 check_status
26
27 for n in ${BRIDGE_INTERFACES}; do
28 echo -n "Adding ${n} to bridge: "
29 brctl addif br0 ${n}
30 # Bring up the interface unless its wireless
31 # Wireless has to be configured before you can put it up
32 if [ $? = 0 ] && [ ${n} != wlan0 ]; then ifconfig ${n} up; fi
33 check_status
34 done
35 ;;
36stop)
37 for n in ${BRIDGE_INTERFACES}; do
38 echo -n "Removing ${n} from bridge br0: "
39 ifconfig ${n} down 2>/dev/null
40 brctl delif br0 ${n}
41 check_status
42 done
43 echo -n "Removing bridge br0: "
44 ifconfig br0 down 2>/dev/null
45 brctl delbr br0
46 check_status
47 ;;
48restart)
49 $0 stop
50 $0 start
51 ;;
52status)
53 brctl show
54 ;;
55*)
56 echo "Usage: $0 {start|stop|restart|status}"
57 exit 1
58esac
59
Note: See TracBrowser for help on using the repository browser.