home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- . $1
-
- if [ "x$ONBOOT" = "xno" ] ; then
- echo "Interface $DEVICE will not be activated."
- exit -1
- fi
-
- if [ "x$WIRELESS" = "xyes" ] ; then
- echo -n "Trying to set up wireless on $DEVICE"
- CMDLINE="$DEVICE"
-
- if [ "x$WIRELESS_NICK" != "x" ] ; then
- CMDLINE="$CMDLINE nick \"$WIRELESS_NICK\""
- fi
-
- if [ "x$WIRELESS_MODE" != "x" ] ; then
- CMDLINE="$CMDLINE mode \"$WIRELESS_MODE\""
- fi
-
- if [ "x$WIRELESS_CHANNEL" != "x" ] ; then
- CMDLINE="$CMDLINE channel \"$WIRELESS_CHANNEL\""
- fi
-
- CMDLINEANYESSID="$CMDLINE essid any"
- if [ "x$WIRELESS_ESSID" != "x" ] ; then
- CMDLINE="$CMDLINE essid \"$WIRELESS_ESSID\""
- fi
-
- iwconfig $CMDLINE
- sleep 2
- fi
-
-
- echo -n "Trying to activate $DEVICE..."
- ifconfig $DEVICE 2>>/dev/null 1>>/dev/null
- if [ $? -ne 0 ] ; then
- echo "could not activate"
- exit -1
- fi
- echo "activated!"
-
-
-
- if [ "x$WIRELESS" = "xyes" ] ; then
- if [ "x$WIRELESS_KEY" != "x" ] ; then
- iwconfig $DEVICE key $WIRELESS_KEY
- iwconfig $DEVICE key restricted
- fi
-
- iwconfig $CMDLINEANYESSID
- sleep 10
-
- iwconfig $CMDLINE
- fi
-
-
-
- # Check if DHCP should be used for interface
- if [ "x$BOOTPROTO" = "xdhcp" ] ; then
- echo -n "Looking for DHCP address..."
- if dhcpcd -t 5 $DEVICE ; then
- echo "found DHCP address"
- let ACTIVEIP++
- else
- echo "Could not find DHCP address"
- fi
- exit -1
- fi
-
- # At this point, BOOTPROTO is assumed to be static,
- # So try to use the IP configuration information
- if [ "x$IPADDR" = "x" ] ; then
- if [ "x$IPADDR_START" = "x" ] ; then
- echo "No IP address specified for $DEVICE"
- exit -1
- else
- if [ "x$CLONENUM_START" = "x" ] ; then
- CLONENUM=1
- else
- CLONENUM=$CLONENUM_START
- fi
- CMDLINE=""
- fi
- else
- CMDLINE="$DEVICE $IPADDR"
- CLONENUM=0
- fi
-
-
- if [ "x$NETMASK" != "x" ] ; then
- CMDLINE="$CMDLINE netmask $NETMASK"
- fi
-
- if [ "x$BROADCAST" != "x" ] ; then
- CMDLINE="$CMDLINE broadcast $BROADCAST"
- fi
-
-
- if [ $CLONENUM -gt 0 ] ; then
- NETADDR=`echo $IPADDR_START |cut -d. -f1-3`
- HOSTADDR=`echo $IPADDR_START |cut -d. -f4`
- ENDADDR=`echo $IPADDR_END |cut -d. -f4`
-
- for (( ; HOSTADDR <= ENDADDR ; HOSTADDR++ )) ; do
- echo "ifconfig $DEVICE:$CLONENUM $NETADDR.$HOSTADDR"
- ifconfig $DEVICE:$CLONENUM $NETADDR.$HOSTADDR
- let CLONENUM++
-
- done
-
- else
- echo "ifconfig $CMDLINE"
- ifconfig $CMDLINE
- if [ $? -ne 0 ] ; then
- exit -1
- fi
- fi
-
-
- exit 0
-