Automatic Wifi enablement at first boot

I need to have the Wifi enabled at boot (for a fresh install) as I don't have device with lan port any more. I was looking at the " Customize installed packages and/or first boot script" option but I'm not sure how to configure both 2.4 and 5GHz Wlans:

======
#
# wlan_name="OpenWrt"
# wlan_password="12345678"
#
# root_password=""
# lan_ip_address="192.168.1.1"
#
-
-
-
# Configure WLAN
# More options: https://openwrt.org/docs/guide-user/network/wifi/basic#wi-fi_interfaces
if [ -n "$wlan_name" -a -n "$wlan_password" -a ${#wlan_password} -ge 8 ]; then
  uci set wireless.@wifi-device[0].disabled='0'
  uci set wireless.@wifi-iface[0].encryption='psk2'
  uci set wireless.@wifi-iface[0].ssid="$wlan_name"
  uci set wireless.@wifi-iface[0].key="$wlan_password"
  uci commit wireless
fi
======

If someone can point me in right direction I will be very grateful.

  • Each wifi-iface section represents a SSID.
  • Each wifi-device section typically represents a band.
  • Each wifi-iface is linked to a specific wifi-device.

Duplicate your config, incrementing the section ID.

1 Like

Thanks, so if I do it like this it should enable both wlans?


===
 uci set wireless.@wifi-device[0].disabled='0'
 uci set wireless.@wifi-iface[0].encryption='psk2'
 uci set wireless.@wifi-iface[0].ssid="WLAN0"
 uci set wireless.@wifi-iface[0].key="password"
 uci set wireless.@wifi-device[1].disabled='0'
 uci set wireless.@wifi-iface[1].encryption='psk2'
 uci set wireless.@wifi-iface[1].ssid="WLAN1"
 uci set wireless.@wifi-iface[1].key="password"
====
1 Like
3 Likes

10 bucks on a (even a crappy) USB to ethernet adapter are well spent.

1 Like