Allow use of the offline_root option
[openwrt.git] / openwrt / target / default / target_skeleton / etc / nvram.overrides
1 # NVRAM overrides
2 #
3 # This file handles the NVRAM quirks of various hardware.
4 # THIS FILE IS NOT A REPLACEMENT FOR NVRAM
5
6 # Load sysconf defaults
7 [ -f /etc/sysconf ] && . /etc/sysconf
8
9 [ "$(nvram get boardnum)" = "asusX" ] && \
10 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
11 asus=1
12 }
13
14 # linksys bug; remove when not using static configuration for lan
15 NVRAM_lan_proto="static"
16
17 # hacks for wrt54g 1.x hardware
18 [ "$(nvram get boardnum)" = "42" ] && \
19 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
20
21 # remap eth0 => vlan2, eth1 => vlan1
22 # for all *_ifname(s)
23
24 debug "### wrt54g 1.x hack ###"
25 NVRAM_vlan1hwname="et0"
26 NVRAM_vlan2hwname="et0"
27 FAILSAFE_ifnames="vlan1 vlan2 eth2"
28
29 remap () {
30 eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
31 }
32
33 for type in lan wifi wan pppoe
34 do
35 remap ${type}_ifname
36 remap ${type}_ifnames
37 done
38 }
39
40 # hacks for wap54g hardware
41 [ "$(nvram get boardnum)" = "2" ] || \
42 [ "$(nvram get boardnum)" = "1024" ] && {
43 debug "### wap54g hack ###"
44 NVRAM_wan_ifname="none"
45 FAILSAFE_ifnames="eth0 eth1"
46 }
47
48 # hack for asus wl-500g hardware
49 [ $asus ] && {
50 FAILSAFE_lan_ifnames="eth0 eth2"
51 }
52
53 # defaults if lan_ifname is missing
54 [ -z "$(nvram get lan_ifname)" ] && {
55 NVRAM_lan_ifname="br0"
56 NVRAM_lan_ifnames=${FAILSAFE_lan_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
57 }
58
59 # defaults if wan_ifname is missing
60 [ -z "$(nvram get wan_ifname)" ] && {
61 NVRAM_wan_ifname="vlan1"
62 NVRAM_wan_proto="dhcp"
63 [ "$asus" ] && {
64 NVRAM_wan_ifname="eth1"
65 }
66 }
67
68 # failsafe if reset is held
69 [ "$FAILSAFE" = "true" ] && {
70 echo "### YOU ARE IN FAILSAFE MODE ####"
71 NVRAM_lan_ifname="br0"
72 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1"}
73 NVRAM_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"}
74 NVRAM_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"}
75 NVRAM_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}
76 NVRAM_wan_ifname="none"
77 NVRAM_wifi_ifname="none"
78 }
This page took 0.044012 seconds and 5 git commands to generate.