#!/bin/sh #[ -e /etc/rc.defaults ] && . /etc/rc.defaults #[ -e /etc/rc.conf ] && . /etc/rc.conf if [ "$NETWORK_CONFIG" != "" ] then . "$NETWORK_CONFIG" fi case "$1" in start) echo ifconfig lo up if [ -n "$wfc_config" ] then eval `wfcdump -c $wfc_config` broadcast= fi if [ -n "$essid" ] then echo "Configuring wireless interface:" echo "ESSID: $essid" echo iwconfig nds essid "$essid" if [ -n "$channel" ] then echo "Channel: $channel" echo iwconfig nds channel "$channel" fi if [ -n "$wepkey" ] then echo "Setting wepkey." echo iwconfig nds key "$wepkey" fi else echo "Not configuring network:" echo "No ESSID defined. See /etc/rc.defaults!" exit 1 fi echo ifconfig nds down if [ -z "$ip" ] then echo "Configuring network via DHCP." # We have very little RAM, so use 'exec' to avoid # forking a new process for the dhcp client. This is # the last command to run anyway if using dhcp. echo exec udhcpc -n -q -i nds ### NOT REACHED ### elif [ -n "$ip" ] then ifconfig_args="" echo "Configuring network:" echo "IP: $ip" echo "Gateway: $gateway" ifconfig_args="$ifconfig_args $ip" if [ -n "$netmask" ] then echo "Netmask: $netmask" ifconfig_args="$ifconfig_args netmask $netmask" fi if [ -n "$broadcast" ] then echo "Broadcast: $broadcast" ifconfig_args="$ifconfig_args broadcast $broadcast" fi echo ifconfig nds $ifconfig_args up if [ -n "$gateway" ] then echo route add default gw "$gateway" fi if [ -n "$dns1" ] then echo "1st DNS: $dns1" echo "nameserver $dns1" \> /etc/resolv.conf if [ -n "$dns2" ] then echo "2nd DNS: $dns2" echo "nameserver $dns2" \>\> /etc/resolv.conf fi fi else echo "Not configuring network:" echo "Static configuration incomplete and DHCP is disabled." exit 1 fi exit 0 ;; stop) echo "Stopping network." echo ifconfig lo down echo ifconfig nds down echo kill \`pidof udhcpc\` 2\> /dev/null ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 " exit 1 ;; esac