#
#	     THIS IS FREE SOFTWARE 
#
# Copyright 2016 Filippo "Fil" Bergamo
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


scriptDiscon=/data/misc/wifi/disconnect.sh
pidfile=/data/misc/wifi/pidfile
configfile=/data/misc/wifi/wpa_supplicant.conf
ifacename=wlan0
ipDNS1=193.183.98.154
ipDNS2=87.98.175.85

# terminate both dhcpcd and wpa_supplicant, in case there are previous connections pending...
bash $scriptDiscon

# launch wpa_supplicant on interface wlan0
# specifing our custom configuration and the socket file
wpa_supplicant -B -dd -i$ifacename -c$configfile -P$pidfile
dhcpcd $ifacename
setprop net.dns1 $ipDNS1
setprop net.dns2 $ipDNS2
