OpenWRT - LEDE uci-defaults for TP-LINK Routers for default factory SSID and KEY
# This is to use on image building process to make TP-Link have autoconfigured with factory SSID and KEY | |
mkdir ./files/etc/uci-defaults/ | |
cat <<'__EOF__' > ./files/etc/uci-defaults/99_default-no-eth.sh | |
#!/bin/sh | |
[ "$(uci -q get system.@system[0].init)" = "" ] && exit 0 | |
[ -e /etc/init ] && exit 0 | |
touch /etc/init | |
uci batch <<EOC | |
set system.@system[0].init='initiated' | |
# This is a TP-Link Router | |
set wireless.@wifi-iface[0].ssid="TP-LINK_$(ifconfig eth0 | awk '/HWaddr/ { printf $5 }' | tr -d : | tail -c 6)" | |
set wireless.@wifi-iface[0].key="$(dd if=/dev/mtdblock0 bs=1 skip=130560 count=8 2>/dev/null)" | |
set wireless.@wifi-iface[0].encryption='psk2+aes' | |
commit | |
EOC | |
/etc/init.d/network restart | |
exit 0 # IMPORTANT, IF WE NO PUT THIS, WILL EXECUTED ENDLESSLY | |
__EOF__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment