From 640e5c566585c04bfa4cdfbf8d89c34d8626108f Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 23 May 2013 20:01:40 +0200 Subject: autowifi with connect_function now --- usr/bin/autowifi | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) mode change 100644 => 100755 usr/bin/autowifi (limited to 'usr') diff --git a/usr/bin/autowifi b/usr/bin/autowifi old mode 100644 new mode 100755 index 9ccff4b7..876dbc15 --- a/usr/bin/autowifi +++ b/usr/bin/autowifi @@ -1,3 +1,17 @@ -#!/usr/bin/sh +#!/bin/sh -x +iface=@wifi-iface[0] +radio=$(uci get wireless.${iface}.device) connect_wifi(){ + ifconfig wlan0 up + uci set wireless.${radio}.channel=$1 + uci set "wireless.${iface}.ssid=$2" + if [ $3 == "none" ] ; then + uci set wireless.${iface}.encryption=none + uci -q delete wireless.${iface}.key + else + uci set "wireless.${iface}.key=$4" + uci set wireless.${iface}.encryption=$3 + fi + wifi up } +connect_wifi "$@" -- cgit v1.2.3