# Setup wpasupplicant (Wireless)
echo "\n### Set wpasupplicant (Wireless) ###\n"
ssid=<somessid>
wpakey=<somereallygoodpassword>
countrycode=US
WIFACE=<your wireless interface>
echo "ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
fast_reauth=1
country=$countrycode
filter_ssids=1
okc=1
network={
ssid=\"$ssid\"
psk=\"$wpakey\"
}" > /etc/wpa_supplicant/wpa_supplicant.conf
# Fix wpa_supplicant service to start only after wireless interface
echo "\n### Fix wpa_supplicant service to start only after wireless interface ###\n"
echo "[Unit]
Description=WPA supplicant
Before=network.target
BindsTo=sys-subsystem-net-devices-$WIFACE.device
After=sys-subsystem-net-devices-$WIFACE.device
[Service]
Type=dbus
BusName=fi.epitest.hostap.WPASupplicant
ExecStart=/sbin/wpa_supplicant -s -u -O /run/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i $WIFACE
[Install]
WantedBy=multi-user.target
Alias=dbus-fi.epitest.hostap.WPASupplicant.service" > /lib/systemd/system/wpa_supplicant.service
# Enable wpa_supplicant service on boot
echo "\n### Enable wpa_supplicant service on boot ###\n"
systemctl enable wpa_supplicant.service