#!/bin/sh ### A simple rc script to bring up and down a wireless card ### # Local IP information DEVICE= IPADDR= NETMASK= BROADCAST= GATEWAY= # Wireless configurations ESSID= CHANNEL= WEP= startDevice() { echo -n "Bringing up $DEVICE..." echo "Done." /sbin/iwconfig $DEVICE key $WEP /sbin/iwconfig $DEVICE channel $CHANNEL /sbin/iwconfig $DEVICE essid $ESSID /sbin/ifconfig $DEVICE $IPADDR broadcast $BROADCAST netmask $NETMASK sleep 1 /sbin/route add default gw $GATEWAY } stopDevice() { echo -n "Shutting down $DEVICE..." echo "Done." /sbin/ifconfig $DEVICE down } case $1 in start) startDevice ;; stop) stopDevice ;; restart) stopDevice startDevice ;; *) echo "Usage: rc.wireless { start | stop | restart }" ;; esac