Root/target/linux/brcm-2.4/base-files/etc/init.d/wmacfixup

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

Archive Download this file



interactive