wmacfixup 562 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2010 OpenWrt.org
  3. START=41
  4. boot() {
  5. [ -d /sys/class/ieee80211 ] || exit
  6. commit=0
  7. fixup_wmac() {
  8. local cfg="$1"
  9. local cfmac
  10. config_get cfmac "$cfg" macaddr
  11. [ "$cfmac" != "00:90:4c:5f:00:2a" ] || {
  12. local nvmac="$(nvram get il0macaddr 2>/dev/null)"
  13. [ -n "$nvmac" ] && [ "$nvmac != "$cfmac ] && {
  14. uci set wireless.$cfg.macaddr="$nvmac"
  15. commit=1
  16. }
  17. }
  18. }
  19. config_load wireless
  20. config_foreach fixup_wmac wifi-device
  21. [ "$commit" = 1 ] && uci commit wireless
  22. }
  23. start() { :; }
  24. stop() { :; }