wireless 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 [ `basename $0` != 'network' ] ; then
  14. echo "Invalid invocation: this script should not be executed directly"
  15. exit 1
  16. fi
  17. # Load site-specific settings
  18. if [ -r ./wireless.opts ] ; then
  19. . ./wireless.opts
  20. else
  21. . /etc/pcmcia/wireless.opts
  22. fi
  23. # Find the path where wireless tools are installed
  24. for IWPATH in /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin /sbin ; do
  25. if [ -x $IWPATH/iwconfig ] ; then break ; fi
  26. done
  27. case "$ACTION" in
  28. 'start')
  29. [ -n "$VERBOSE" -a -n "$INFO" ] && echo "$INFO"
  30. # Set all desired settings via iwconfig
  31. # Mode need to be first : some settings apply only in a specific mode !
  32. if [ -n "$MODE" ] ; then
  33. log $IWPATH/iwconfig $DEVICE mode $MODE
  34. fi
  35. # This is a bit hackish, but should do the job right...
  36. if [ ! -n "$NICKNAME" ] ; then
  37. NICKNAME=`/bin/hostname`
  38. fi
  39. if [ -n "$ESSID" -o -n "$MODE" ] ; then
  40. log $IWPATH/iwconfig $DEVICE nick \"$NICKNAME\" >/dev/null 2>&1
  41. fi
  42. # Regular stuff...
  43. if [ -n "$NWID" ] ; then
  44. log $IWPATH/iwconfig $DEVICE nwid $NWID
  45. fi
  46. if [ -n "$FREQ" ] ; then
  47. log $IWPATH/iwconfig $DEVICE freq $FREQ
  48. elif [ -n "$CHANNEL" ] ; then
  49. log $IWPATH/iwconfig $DEVICE channel $CHANNEL
  50. fi
  51. if [ -n "$SENS" ] ; then
  52. log $IWPATH/iwconfig $DEVICE sens $SENS
  53. fi
  54. if [ -n "$RATE" ] ; then
  55. log $IWPATH/iwconfig $DEVICE rate $RATE
  56. fi
  57. if [ -n "$KEY" ] ; then
  58. log $IWPATH/iwconfig $DEVICE key $KEY
  59. fi
  60. if [ -n "$RTS" ] ; then
  61. log $IWPATH/iwconfig $DEVICE rts $RTS
  62. fi
  63. if [ -n "$FRAG" ] ; then
  64. log $IWPATH/iwconfig $DEVICE frag $FRAG
  65. fi
  66. # More specific parameters
  67. if [ -n "$IWCONFIG" ] ; then
  68. log $IWPATH/iwconfig $DEVICE $IWCONFIG
  69. fi
  70. if [ -n "$IWSPY" ] ; then
  71. log $IWPATH/iwspy $DEVICE $IWSPY
  72. fi
  73. if [ -n "$IWPRIV" ] ; then
  74. log $IWPATH/iwpriv $DEVICE $IWPRIV
  75. fi
  76. # ESSID need to be last : most device re-perform the scanning/discovery
  77. # when this is set, and things like encryption keys are better be
  78. # defined if we want to discover the right set of APs/nodes.
  79. if [ -n "$ESSID" ] ; then
  80. log $IWPATH/iwconfig $DEVICE essid \"$ESSID\"
  81. fi
  82. ;;
  83. 'cksum')
  84. chk_simple "$NEW_SCHEME,$SOCKET,$INSTANCE,$HWADDR"
  85. WIRELESS=$?
  86. ;;
  87. 'stop'|'check'|'restart'|'suspend'|'resume')
  88. ;;
  89. *)
  90. usage
  91. ;;
  92. esac