source: clfs-embedded/bootscripts/clfs/rc.d/init.d/bcm47xx-switch@ 1f35837

Last change on this file since 1f35837 was c05b9cf, checked in by Maarten Lankhorst <mlankhorst@…>, 15 years ago

bootscripts: Add bcm47xx scripts

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/ash
2#
3# Broadcom 47xx vlan and switch configuration init script
4#
5# Config: uses the 'nvram' settings for setting up vlan devices
6
7. /etc/rc.d/init.d/functions
8
9if [ ! -x /sbin/robocfg ]; then
10 echo -n "Setting up vlan: /sbin/robocfg not found "
11 false
12 check_status
13fi
14
15if [ ! -x /sbin/vconfig ]; then
16 echo -n "Setting up vlan: /sbin/vconfig not found "
17 false
18 check_status
19fi
20
21if [ ! -x /sbin/nvram ]; then
22 echo -n "Setting up vlan: /sbin/nvram not found "
23 false
24 check_status
25fi
26
27case "$1" in
28start)
29 n=0
30
31 # eth0 has to be up for this
32 ifconfig eth0 up
33
34 robocfg switch disable
35 robocfg vlans enable reset
36
37 nvram show | grep vlan[0-4]ports= | sed -e s/vlan// -e s/ports=/\ / |
38 while read vlan ports; do
39 echo -n "Bringing up eth0.${vlan}: "
40 robocfg vlan ${vlan} ports "${ports}" &&
41 vconfig add eth0 $vlan
42 check_status
43 done
44 robocfg switch enable
45 exit 0
46 ;;
47stop)
48 # FIXME: Should we really do something at shutdown?
49 exit 0
50 ;;
51restart)
52 $0 stop
53 $0 start
54 ;;
55status)
56 robocfg show
57 ;;
58*)
59 echo "Usage: $0 {start|stop|restart|status}"
60 exit 1
61esac
62
Note: See TracBrowser for help on using the repository browser.