add unprivileged user
[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 # hacks for buffalo wla2-g54l
49 [ "$(nvram get boardnum)" = "00" ] && \
50 [ "$(nvram get product_name)" = "Product_name" ] && {
51 debug "### wla2-g54l hacks ###"
52 NVRAM_lan_ifnames="vlan0"
53 NVRAM_wan_ifname="none"
54 }
55
56 # hack for asus wl-500g hardware
57 [ $asus ] && {
58 FAILSAFE_lan_ifnames="eth0 eth2"
59 }
60
61 # hacks for asus wl-500g deluxe
62 [ "$(nvram get boardtype)" = "bcm95365r" ] && \
63 [ "$(nvram get boardnum)" = "45" ] && {
64 debug "### wl-500g deluxe hacks ###"
65 NVRAM_vlan0hwname="et0"
66 NVRAM_vlan1hwname="et0"
67 NVRAM_lan_ifnames="vlan0 eth1"
68 NVRAM_wan_ifname="vlan1"
69 }
70
71 # defaults if lan_ifname is missing
72 [ -z "$(nvram get lan_ifname)" ] && {
73 NVRAM_lan_ifname="br0"
74 NVRAM_lan_ifnames=${FAILSAFE_lan_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
75 }
76
77 # defaults if wan_ifname is missing
78 [ -z "$(nvram get wan_ifname)" ] && {
79 NVRAM_wan_ifname="vlan1"
80 NVRAM_wan_proto="dhcp"
81 [ "$asus" ] && {
82 NVRAM_wan_ifname="eth1"
83 }
84 }
85
86 # failsafe if reset is held
87 [ "$FAILSAFE" = "true" ] && {
88 echo "### YOU ARE IN FAILSAFE MODE ####"
89 NVRAM_lan_ifname="br0"
90 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1"}
91 NVRAM_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"}
92 NVRAM_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"}
93 NVRAM_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}
94 NVRAM_wan_ifname="none"
95 NVRAM_wifi_ifname="none"
96 }
This page took 0.062145 seconds and 5 git commands to generate.