. /etc/network.overrides
alias debug=${DEBUG:-:}
+# WGT634u
+[ "$(/usr/bin/head -c4 /dev/mtdblock/1 | /usr/bin/tail -c3)" = "ELF" ] && exit
+
remap () {
for type in lan wifi wan pppoe
do
}
nvram_set() { # for the linksys fixup part
- [ "$(nvram get "$1")" = "$2" ] || {
+ [ "$(nvram get "$1")" = "$2" -a "$2" != "" ] || {
COMMIT=1
- nvram set "$1=$2"
+ /usr/sbin/nvram set "$1=$2"
}
}
# work around braindead CFE defaults in linksys routers
boardtype=$(nvram get boardtype)
boardflags=$(($(nvram get boardflags)))
-[ "$boardtype" = "bcm4710dev" ] && boardtype="0xdeadbeef"
+[ "$boardtype" = "bcm94710dev" ] && boardtype="0xdeadbeef"
adm_switch="$(( ($boardflags & 0x80) >> 7 ))"
case "$(( $boardtype ))" in
"$((0x708))")
if [ "$adm_switch" = 0 ]; then
- nvram_set sdram_init 0x010b
+ nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
[ "$COMMIT" = 1 ] && {
nvram_set sdram_config 0x0062
nvram_set clkfreq 216
fi
;;
"$((0x467))")
- nvram_set sdram_init 0x010c
+ nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
[ "$COMMIT" = 1 ] && {
nvram_set sdram_config 0x0062
nvram_set sdram_ncdl 0x0
nvram set lan_ifnames="eth1 eth2"
nvram set wan_ifname="none"
;;
+ *)
+ # wl-500g defaults. these are placed here, because WL-HDD and WL-300g
+ # might have the same nvram settings.
+ [ "$(nvram get boardnum)" = "asusX" \
+ -a "$(nvram get boardtype)" = "bcm94710dev" ] && {
+ nvram_default wan_device "eth1"
+ }
+ ;;
esac
# hacks for wap54g hardware
nvram_default wl0id 0x4320
}
-WAN_PROTO="$(nvram get wan_proto)"
-[ "$WAN_PROTO" = "pptp" \
--o "$WAN_PROTO" = "pppoe" ] && {
- WAN_IFNAME="$(nvram get wan_ifname)"
- [ "${WAN_IFNAME%%[0-9]*}" = "ppp" ] || {
- nvram set wan_ifname=ppp0
- nvram set ${WAN_PROTO}_ifname="$WAN_IFNAME"
- }
-}
-
# defaults
nvram_default lan_ifname "br0"
nvram_default lan_ifnames "$FAILSAFE_ifnames"
nvram_default wan_ifname "vlan1"
+nvram_default wan_device "vlan1"
nvram_default wan_proto "dhcp"
nvram_default wl0_ssid OpenWrt
nvram_default wl0_infra 1
nvram_default wl0_radio 1
+WAN_PROTO="$(nvram get wan_proto)"
+WAN_IFNAME="$(nvram get wan_ifname)"
+case "$WAN_PROTO" in
+ pp*) [ "${WAN_IFNAME%%[0-9]*}" = "ppp" ] || nvram set wan_ifname=ppp0;;
+ *) [ "${WAN_IFNAME%%[0-9]*}" = "ppp" ] && nvram set wan_ifname="$(nvram get wan_device)";;
+esac
+
[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && {
# if default wifi mac, set two higher than the lan mac
nvram set il0macaddr=$(nvram get et0macaddr|