Forked from braian87b/OpenWRT-LEDE-uci-defauls-TP-LINK-factory-SSID-KEY.sh
Created
May 10, 2021 02:38
-
-
Save brosahay/e2e144e3baf312850edc24eec7e9f148 to your computer and use it in GitHub Desktop.
OpenWRT - LEDE uci-defaults for TP-LINK Routers for default factory SSID and KEY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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