cyberchallenge-modem/conf/wifi/connect.sh

12 lines
324 B
Bash
Executable File

#!/bin/sh
if [ "$#" -ne 2 ]; then
echo "Usage: connect.sh: <ssid> <psk>"
exit 1
fi
/bin/echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf
/usr/bin/wpa_passphrase "$1" "$2" >> /etc/wpa_supplicant.conf
/usr/sbin/wpa_supplicant -B -i client0 -c /etc/wpa_supplicant.conf
/sbin/udhcpc -i client0