Silence!
[madwifi.git] / ifup-pre-local
1 #!/bin/bash
2 #
3 # $Id$
4 # Script to set the mode for MADWIFI. Should be called by ifup.
5 # Copyright (C) 2007 The Trustees of Princeton University
6
7 . /etc/sysconfig/network-scripts/network-functions
8 CONFIG="$1"
9 source_config
10
11 WLANDEV=$(basename $(readlink -e /sys/class/net/$DEVICE/device/net:wifi* 2>/dev/null) 2>/dev/null)
12 if [ -n "$MODE$WLANDEV" ]; then
13     wlanconfig "$DEVICE" destroy &> /dev/null
14     m=$( echo "$MODE" | tr '[A-Z]' '[a-z]' | tr -d - )
15     case "$m" in
16       managed)
17         m=sta
18         ;;
19       master)
20         m=ap
21         ;;
22       repeater)
23         m=wds
24         ;;
25     esac
26     wlanconfig "$DEVICE" create wlandev $WLANDEV wlanmode "$m" > /dev/null
27 fi