#!/bin/ash # # Broadcom 47xx vlan and switch configuration init script # # Config: uses the 'nvram' settings for setting up vlan devices . /etc/rc.d/init.d/functions if [ ! -x /sbin/robocfg ]; then echo -n "Setting up vlan: /sbin/robocfg not found " false check_status fi if [ ! -x /sbin/vconfig ]; then echo -n "Setting up vlan: /sbin/vconfig not found " false check_status fi if [ ! -x /sbin/nvram ]; then echo -n "Setting up vlan: /sbin/nvram not found " false check_status fi case "$1" in start) n=0 # eth0 has to be up for this ifconfig eth0 up robocfg switch disable robocfg vlans enable reset nvram show | grep vlan[0-4]ports= | sed -e s/vlan// -e s/ports=/\ / | while read vlan ports; do echo -n "Bringing up eth0.${vlan}: " robocfg vlan ${vlan} ports "${ports}" && vconfig add eth0 $vlan check_status done robocfg switch enable exit 0 ;; stop) # FIXME: Should we really do something at shutdown? exit 0 ;; restart) $0 stop $0 start ;; status) robocfg show ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac