Date: Sat, 23 Oct 2004 14:10:24 GMT From: Vlad Manilici <vman@fx.homeunix.org> To: freebsd-bugs@FreeBSD.org Subject: Re: conf/72964 Message-ID: <200410231410.i9NEAOYU028387@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/72964; it has been noted by GNATS. From: Vlad Manilici <vman@fx.homeunix.org> To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: conf/72964 Date: Sat, 23 Oct 2004 16:01:08 +0200 hi, an updated version of the script: - code rearrange - allow for non-WEP setup (keyword: "none") - shutdown the interfaces ================================================================================ #!/bin/sh # $Id: wireless,v 1.10 2004/10/23 14:00:21 root Exp $ # PROVIDE: wireless # REQUIRE: mountcritlocal # BEFORE: dhclient # KEYWORD: FreeBSD . /etc/rc.subr name="wireless" rcvar=`set_rcvar` start_cmd="wireless_start" stop_cmd="wireless_stop" # global: list of processed interfaces ifs='' # if_start $if $ssid $key if_start(){ if=$1 ssid=$2 key=$3 echo -n configuring interface $if / $ssid ... if ifconfig $if 2>&1|grep -q 'does not exist'; then echo ' does not exist' elif ifconfig $if | grep -q 'status: associated'; then echo ' already configured' else if [ "$key" = "none" ]; then ifconfig $if inet 0.0.0.0 powersave\ station wlan ssid $ssid else ifconfig $if inet 0.0.0.0 powersave wepmode on\ station wlan ssid $ssid wepkey $key fi # delay sleep 1; wicontrol -L >&- if ifconfig $if | grep -q 'status: associated'; then echo ' ok' else echo ' no association' ifconfig $if down fi fi } # if_stop $if if_stop(){ if=$1 # skip if already processed if echo $ifs|grep -qv $if; then echo -n stopping interface $if ... # remember this interface ifs="$ifs $if" if ifconfig $if 2>&1|grep -q 'does not exist'; then echo ' does not exist' elif ifconfig $if | grep -q 'status: associated'; then ifconfig $if down if ifconfig $if | grep -q 'status: associated'; then echo ' error' else echo ' down' fi else echo ' no association' fi fi } # cycle start|stop cycle(){ action=$1 # read configuration for item in ${wireless_flags}; do # read items if [ -z "$if" ]; then if=$item elif [ -z "$ssid" ]; then ssid=$item elif [ -z "$key" ]; then key=$item fi # configure if [ -n "$if" -a -n "$ssid" -a -n "$key" ]; then if [ "$action" = "start" ]; then # start if_start $if $ssid $key elif [ "$action" = "stop" ]; then # stop if_stop $if fi # clean items if='' ssid='' key='' fi done } wireless_start(){ cycle start } wireless_stop(){ cycle stop } load_rc_config $name run_rc_command "$1" ================================================================================ vlad
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410231410.i9NEAOYU028387>