#!/bin/sh

WIFI_DEV=`uci -q get wireless.wifi2g.device`
MODE="ap"
NETWORK="lan"
ENCRYPTION="none"
SSID_PREFIX="iStoreOS"

START_NUM=2
END_NUM=15

for i in $(seq $START_NUM $END_NUM); do
  CONFIG_NAME="wifi2g$i"
  IFNAME="ra$i"
  SSID="$SSID_PREFIX$i"

  uci -q batch <<-EOF >/dev/null
    delete wireless.$CONFIG_NAME
    set wireless.$CONFIG_NAME="wifi-iface"
    set wireless.$CONFIG_NAME.device="$WIFI_DEV"
    set wireless.$CONFIG_NAME.mode="$MODE"
    set wireless.$CONFIG_NAME.network="$NETWORK"
    set wireless.$CONFIG_NAME.ifname="$IFNAME"
    set wireless.$CONFIG_NAME.encryption="$ENCRYPTION"
    set wireless.$CONFIG_NAME.ssid="$SSID"
    set wireless.$CONFIG_NAME.disabled="1"
    commit wireless
EOF
done


WIFI_DEV=`uci -q get wireless.wifi5g.device`
MODE="ap"
NETWORK="lan"
ENCRYPTION="none"
SSID_PREFIX="iStoreOS"

START_NUM=2
END_NUM=15
for i in $(seq $START_NUM $END_NUM); do
  CONFIG_NAME="wifi5g$i"
  IFNAME="rax$i"
  SSID="$SSID_PREFIX$i"

  uci -q batch <<-EOF >/dev/null
    delete wireless.$CONFIG_NAME
    set wireless.$CONFIG_NAME="wifi-iface"
    set wireless.$CONFIG_NAME.device="$WIFI_DEV"
    set wireless.$CONFIG_NAME.mode="$MODE"
    set wireless.$CONFIG_NAME.network="$NETWORK"
    set wireless.$CONFIG_NAME.ifname="$IFNAME"
    set wireless.$CONFIG_NAME.encryption="$ENCRYPTION"
    set wireless.$CONFIG_NAME.ssid="${SSID}_5G"
    set wireless.$CONFIG_NAME.disabled="1"
    commit wireless
EOF
done


