home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 January / PCpro_2005_01.ISO / isolinux / all.rdz / initrd / etc / pcmcia / wireless < prev   
Encoding:
Text File  |  2004-03-24  |  2.8 KB  |  113 lines

  1. #!/bin/sh
  2. #
  3. # wireless network 1.63 2000/02/09 03:12:42 (David Hinds/Jean Tourrilhes)
  4. #
  5. # Specific configuration of a PCMCIA wireless LAN adapter
  6. #
  7. # This script is invoked automatically by the network script; it should
  8. # not be executed by hand.
  9. #
  10. # Note : it would be real cool to have the name of the driver as part
  11. # of the extended device address
  12. #
  13. if ! typeset -f usage ; then
  14.   if [ -f ./shared ] ; then
  15.      . ./shared
  16.   else
  17.     . /etc/pcmcia/shared
  18.   fi
  19. fi
  20.  
  21. get_info $DEVICE
  22. ADDRESS="$SCHEME,$SOCKET,$INSTANCE,$HWADDR"
  23.  
  24. if [ `basename $0` != 'network' ] ; then
  25.     echo "Invalid invocation: this script should not be executed directly"
  26.     exit 1
  27. fi
  28.  
  29. # Load site-specific settings
  30. if [ -r ./wireless.opts ] ; then
  31.     . ./wireless.opts
  32. else
  33.     . /etc/pcmcia/wireless.opts
  34. fi
  35.  
  36. # Find the path where wireless tools are installed
  37. for IWPATH in /usr/{bin,sbin} /usr/local/{bin,sbin} /sbin ; do
  38.     if [ -x $IWPATH/iwconfig ] ; then break ; fi
  39. done
  40.  
  41. case "$ACTION" in
  42.  
  43. 'start')
  44.     [ -n "$VERBOSE" -a -n "$INFO" ] && echo "$INFO"
  45.     # Set all desired settings via iwconfig
  46.  
  47.     # Mode need to be first : some settings apply only in a specific mode !
  48.     if [ -n "$MODE" ] ; then
  49.     log $IWPATH/iwconfig $DEVICE mode $MODE
  50.     fi
  51.     # This is a bit hackish, but should do the job right...
  52.     if [ ! -n "$NICKNAME" ] ; then
  53.         NICKNAME=`/bin/hostname`
  54.     fi
  55.     if [ -n "$ESSID" -o -n "$MODE" ] ; then
  56.     log $IWPATH/iwconfig $DEVICE nick \"$NICKNAME\" >/dev/null 2>&1
  57.     fi
  58.     # Regular stuff...
  59.     if [ -n "$NWID" ] ; then
  60.     log $IWPATH/iwconfig $DEVICE nwid $NWID
  61.     fi
  62.     if [ -n "$FREQ" ] ; then
  63.     log $IWPATH/iwconfig $DEVICE freq $FREQ
  64.     elif [ -n "$CHANNEL" ] ; then
  65.     log $IWPATH/iwconfig $DEVICE channel $CHANNEL
  66.     fi
  67.     if [ -n "$SENS" ] ; then
  68.     log $IWPATH/iwconfig $DEVICE sens $SENS
  69.     fi
  70.     if [ -n "$RATE" ] ; then
  71.     log $IWPATH/iwconfig $DEVICE rate $RATE
  72.     fi
  73.     if [ -n "$KEY" ] ; then
  74.     log $IWPATH/iwconfig $DEVICE key $KEY
  75.     fi
  76.     if [ -n "$RTS" ] ; then
  77.     log $IWPATH/iwconfig $DEVICE rts $RTS
  78.     fi
  79.     if [ -n "$FRAG" ] ; then
  80.     log $IWPATH/iwconfig $DEVICE frag $FRAG
  81.     fi
  82.     # More specific parameters
  83.     if [ -n "$IWCONFIG" ] ; then
  84.     log $IWPATH/iwconfig $DEVICE $IWCONFIG
  85.     fi
  86.     if [ -n "$IWSPY" ] ; then
  87.     log $IWPATH/iwspy $DEVICE $IWSPY
  88.     fi
  89.     if [ -n "$IWPRIV" ] ; then
  90.     log $IWPATH/iwpriv $DEVICE $IWPRIV
  91.     fi
  92.     # ESSID need to be last : most device re-perform the scanning/discovery
  93.     # when this is set, and things like encryption keys are better be
  94.     # defined if we want to discover the right set of APs/nodes.
  95.     if [ -n "$ESSID" ] ; then
  96.     log $IWPATH/iwconfig $DEVICE essid \"$ESSID\"
  97.     fi
  98.     ;;
  99.  
  100. 'cksum')
  101.     chk_simple "$NEW_SCHEME,$SOCKET,$INSTANCE,$HWADDR"
  102.     WIRELESS=$?
  103.     ;;
  104.  
  105. 'stop'|'check'|'restart'|'suspend'|'resume')
  106.     ;;
  107.  
  108. *)
  109.     usage
  110.     ;;
  111.  
  112. esac
  113.