The OpenWrt Firmware Selector

@aparcar now added a field that let the user add a script to custom images:

This script e.g. would automatically enable and configure the WiFi:

# WiFi password (at least 8 characters)
key="12345678"
# WiFi name
ssid="OpenWrt"

wifi_enable_device() {
  local cfg="$1"
  uci set wireless.$cfg.disabled='0'
}

wifi_setup_interface() {
  local cfg="$1"
  uci set wireless.$cfg.ssid="$ssid"
  uci set wireless.$cfg.key="$key"
  uci set wireless.$cfg.encryption="psk2"
}

config_load wireless
config_foreach wifi_enable_device wifi-device
config_foreach wifi_setup_interface wifi-iface
uci commit wireless

The script will be placed in /etc/uci-defaults/ of the image, executed on first boot and then deleted. More information can be found in the OpenWrt documentation.

EDIT: the firmware selector now fills in a script like this on an icon click (gear icon in the right coner).

16 Likes