]> git.pld-linux.org Git - packages/wireless-tools.git/commitdiff
- very simply script to configure wavelan interfaces
authormichuz <michuz@pld-linux.org>
Tue, 27 Nov 2001 02:58:02 +0000 (02:58 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    wireless.init -> 1.1

wireless.init [new file with mode: 0755]

diff --git a/wireless.init b/wireless.init
new file mode 100755 (executable)
index 0000000..ade07ac
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/sh
+# $Id$
+#
+# wavelan      Configure WaveLAN interfaces
+#
+# chkconfig:   2345 50 11
+# description: This script take care of setting rights params
+#              wavelan cards.
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+case "$1" in
+  start)
+       show "Setting WaveLAN interfaces"
+       busy
+       interfaces_boot=$((cd /etc/sysconfig/interfaces && ls -1 ifcfg* | \
+        egrep -v '(ifcfg-lo|ifcfg-sit|ifcfg-atm|ifcfg-lec|ifcfg-nas|:)' | \
+       egrep 'ifcfg-[a-z0-9\.]+$' | xargs egrep -l "ONBOOT=[^n][^o]" | \
+        awk ' { gsub(/ifcfg-/,NIL); print $0 } ') 2> /dev/null)
+
+       for i in $interfaces_boot ; do
+               # cleaning all vars
+               INFO=""
+               ESSID=""
+               NWID=""
+               MODE=""
+               FREQ=""
+               CHANNEL=""
+               SENS=""
+               RATE=""
+               KEY=""
+               RTS=""
+               FRAG=""
+               NICKNAME=""
+
+               . /etc/sysconfig/interfaces/ifcfg-$i
+               # Mode need to be first : some settings apply only in a specific mode !
+               if [ -n "$MODE" ] ; then
+                       /usr/sbin/iwconfig $i mode $MODE >/dev/null 2>&1
+               fi
+       
+               # This is a bit hackish, but should do the job right...
+               if [ ! -n "$NICKNAME" ] ; then
+                       NICKNAME=`/bin/hostname`
+               fi
+               if [ -n "$ESSID" -o -n "$MODE" ] ; then
+                       /usr/sbin/iwconfig $i nick $NICKNAME >/dev/null 2>&1
+               fi
+       
+               # Regular stuff...
+               if [ -n "$NWID" ] ; then
+                       /usr/sbin/iwconfig $i nwid $NWID >/dev/null 2>&1
+               fi
+               if [ -n "$FREQ" ] ; then
+                       /usr/sbin/iwconfig $i freq $FREQ >/dev/null 2>&1
+               elif [ -n "$CHANNEL" ] ; then
+                       /usr/sbin/iwconfig $i channel $CHANNEL >/dev/null 2>&1
+               fi
+               if [ -n "$SENS" ] ; then
+                       /usr/sbin/iwconfig $i sens $SENS >/dev/null 2>&1
+               fi
+               if [ -n "$RATE" ] ; then
+                       /usr/sbin/iwconfig $i rate $RATE >/dev/null 2>&1
+               fi
+               if [ -n "$KEY" ] ; then
+                       /usr/sbin/iwconfig $i key $KEY >/dev/null 2>&1
+               fi
+               if [ -n "$RTS" ] ; then
+                       /usr/sbin/iwconfig $i rts $RTS >/dev/null 2>&1
+               fi
+               if [ -n "$FRAG" ] ; then
+                       /usr/sbin/iwconfig $i frag $FRAG >/dev/null 2>&1
+               fi
+       
+               # ESSID need to be last : most device re-perform the scanning/discovery
+               # when this is set, and things like encryption keys are better be
+               # defined if we want to discover the right set of APs/nodes.
+               if [ -n "$ESSID" ] ; then
+                   /usr/sbin/iwconfig $i essid $ESSID >/dev/null 2>&1
+               fi
+       done
+       deltext
+       ok
+       ;;
+  reload)
+       $0 start
+       ;;
+  *)
+       echo "Usage: $0 {start|reload}"
+esac
This page took 0.157323 seconds and 4 git commands to generate.