mir3c/squashfs-root/sbin/setssid_fact

26 lines
680 B
Bash
Executable File

#!/bin/sh
mac=$(getmac wan)
mac_b5=$(echo $mac | cut -d ':' -f 5)
mac_b6=$(echo $mac | cut -d ':' -f 6)
# Generate default SSID and SSID for uninitialized device
# Extend UID part of default SSID
prefix=Xiaomi
uid=$(printf "%04X" $((0x$mac_b5$mac_b6)))
extender=$(printf "%04X" $((0xffff-0x$uid)))
ifconfig wl0 1>&- 2>&- && {
bdata set "wl0_ssid=${prefix}_${uid}_5G"
nvram set "wl0_ssid=${prefix}_${uid}_${extender}_5G"
}
ifconfig wl1 1>&- 2>&- && {
bdata set "wl1_ssid=${prefix}_${uid}"
nvram set "wl1_ssid=${prefix}_${uid}_${extender}"
}
bdata commit
nvram commit
# SSIDs in wireless config will be updated by wifi detect during next boot
rm -f /etc/config/wireless
sync