summaryrefslogtreecommitdiffstats
path: root/obsolete-buildroot/sources/openwrt/root/etc
diff options
context:
space:
mode:
authormbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2004-09-07 05:54:07 +0000
committermbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2004-09-07 05:54:07 +0000
commit6500719d9cd1b9bb7cf1cff5051c6396886b4537 (patch)
treee7b29805a8212a77fc3aa614bc2d76b9b5e35547 /obsolete-buildroot/sources/openwrt/root/etc
parent437d48bef2502dc85ef8f53fa51ef08c84d9e204 (diff)
wap54g support
separate S50services into individual files move nvram_get to 'nvram get' making nvram overrides more transparent git-svn-id: svn://svn.openwrt.org/openwrt/trunk@155 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'obsolete-buildroot/sources/openwrt/root/etc')
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/functions.sh11
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/init.d/S10boot11
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/init.d/S40network4
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/init.d/S45firewall2
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/init.d/S50dnsmasq2
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/init.d/S50httpd (renamed from obsolete-buildroot/sources/openwrt/root/etc/init.d/S50services)2
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/init.d/S50telnet2
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/init.d/S99done3
-rw-r--r--obsolete-buildroot/sources/openwrt/root/etc/ipkg.conf2
-rw-r--r--obsolete-buildroot/sources/openwrt/root/etc/nvram.overrides73
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/etc/preinit8
-rw-r--r--obsolete-buildroot/sources/openwrt/root/etc/profile4
12 files changed, 67 insertions, 57 deletions
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/functions.sh b/obsolete-buildroot/sources/openwrt/root/etc/functions.sh
index 79db1dad3..6da7df295 100755
--- a/obsolete-buildroot/sources/openwrt/root/etc/functions.sh
+++ b/obsolete-buildroot/sources/openwrt/root/etc/functions.sh
@@ -3,8 +3,11 @@
alias debug=${DEBUG:-:}
# allow env to override nvram
-nvram_get () {
- eval "echo \${$1:-\$(nvram get $1)}"
+nvram () {
+ case $1 in
+ get) eval "echo \${NVRAM_$2:-\$(command nvram get $2)}";;
+ *) command nvram $*;;
+ esac
}
. /etc/nvram.overrides
@@ -12,8 +15,8 @@ nvram_get () {
if_valid () (
[ "${1%%[0-9]}" = "vlan" ] && {
i=${1#vlan}
- hwname=$(nvram_get vlan${i}hwname)
- hwaddr=$(nvram_get ${hwname}macaddr)
+ hwname=$(nvram get vlan${i}hwname)
+ hwaddr=$(nvram get ${hwname}macaddr)
[ -z "$hwaddr" ] && return 1
vif=$(ifconfig -a | awk '/^eth.*'$hwaddr'/ {print $1; exit}' IGNORECASE=1)
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S10boot b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S10boot
index 0d8f2e2bb..b650c9464 100755
--- a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S10boot
+++ b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S10boot
@@ -1,14 +1,14 @@
#!/bin/sh
+syslogd -C 16
sysctl -p
echo "S" > /proc/jffs2_bbc
mkdir -p /var/run
-# networking stub
[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && {
- # force unique wireless mac
+ # if default wifi mac, set two higher than the lan mac
nvram set il0macaddr=$(nvram get et0macaddr|
- awk '{OFS=FS=":";for(x=6,y=2;x;x--){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
+ awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
}
insmod et
@@ -18,12 +18,7 @@ ifconfig lo 127.0.0.1 up
ifconfig eth0 promisc
HOSTNAME=$(nvram get wan_hostname)
-DOMAINNAME=${HOSTNAME##*.}
HOSTNAME=${HOSTNAME%%.*}
-
echo ${HOSTNAME:=OpenWrt} > /proc/sys/kernel/hostname
-echo ${DOMAINNAME:=lan} > /proc/sys/kernel/domainname
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
-
-syslogd -C 16
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S40network b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S40network
index 5a6ca725b..a8144a837 100755
--- a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S40network
+++ b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S40network
@@ -7,9 +7,9 @@ case "$1" in
ifup wifi
wifi up
- for route in $(nvram_get static_route); do {
+ for route in $(nvram get static_route); do {
eval "set $(echo $route | sed 's/:/ /g')"
- route add -net $1 netmask $2 gw $3 metric $4 dev $5
+ $DEBUG route add -net $1 netmask $2 gw $3 metric $4 dev $5
} done
;;
esac
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S45firewall b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S45firewall
index 4885c7c08..49b9df000 100755
--- a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S45firewall
+++ b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S45firewall
@@ -1,7 +1,7 @@
#!/bin/sh
. /etc/functions.sh
-WAN=$(nvram_get wan_ifname)
+WAN=$(nvram get wan_ifname)
IPT=/usr/sbin/iptables
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50dnsmasq b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50dnsmasq
new file mode 100755
index 000000000..995c1b6e7
--- /dev/null
+++ b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50dnsmasq
@@ -0,0 +1,2 @@
+#!/bin/sh
+/usr/sbin/dnsmasq
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50services b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50httpd
index bdd1102f9..fd66f8032 100755
--- a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50services
+++ b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50httpd
@@ -1,4 +1,2 @@
#!/bin/sh
-/usr/sbin/telnetd -l /bin/login
/usr/sbin/httpd -p 80 -h /www -r WRT54G Router
-/usr/sbin/dnsmasq
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50telnet b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50telnet
new file mode 100755
index 000000000..29af5040a
--- /dev/null
+++ b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S50telnet
@@ -0,0 +1,2 @@
+#!/bin/sh
+/usr/sbin/telnetd -l /bin/login
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S99done b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S99done
index 73a4da468..8811e99bf 100755
--- a/obsolete-buildroot/sources/openwrt/root/etc/init.d/S99done
+++ b/obsolete-buildroot/sources/openwrt/root/etc/init.d/S99done
@@ -1,6 +1,7 @@
#!/bin/sh
+# automagically run firstboot
[ -z "$FAILSAFE" ] && {
{ mount | grep jffs2 1>&-; } || firstboot
}
-# turn off DMZ led
+# set leds to normal state
echo "0x00" > /proc/sys/diag
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/ipkg.conf b/obsolete-buildroot/sources/openwrt/root/etc/ipkg.conf
index c3581d790..31a5fdfe1 100644
--- a/obsolete-buildroot/sources/openwrt/root/etc/ipkg.conf
+++ b/obsolete-buildroot/sources/openwrt/root/etc/ipkg.conf
@@ -1,3 +1,3 @@
-src openwrt http://openwrt.ksilebo.net/ipkg
+src openwrt http://openwrt.org/ipkg
dest root /
dest ram /tmp
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/nvram.overrides b/obsolete-buildroot/sources/openwrt/root/etc/nvram.overrides
index f59e78060..e3a3217ff 100644
--- a/obsolete-buildroot/sources/openwrt/root/etc/nvram.overrides
+++ b/obsolete-buildroot/sources/openwrt/root/etc/nvram.overrides
@@ -1,53 +1,60 @@
# NVRAM overrides
-# This file handles the NVRAM quirks of various hardware.
#
+# This file handles the NVRAM quirks of various hardware.
# THIS FILE IS NOT A REPLACEMENT FOR NVRAM
-# linksys bug has lan doing dhcp; force static
-lan_proto="static"
+# linksys bug; remove when not using static configuration for lan
+NVRAM_lan_proto="static"
-# hacks for 1.x hardware
+# hacks for wrt54g 1.x hardware
[ "$(nvram get boardnum)" = "42" ] && \
[ "$(nvram get boardtype)" = "bcm94710dev" ] && {
- debug "### 1.x hardware hack ###"
- vlan1hwname="et0"
- vlan2hwname="et0"
-
- # we remap old device names to new
- # it's recommended that you continue to
- # use the old names to preserve backwards
- # compatibility
+
+ # remap eth0 => vlan2, eth1 => vlan1
+ # for all *_ifname(s)
+
+ debug "### wrt54g 1.x hack ###"
+ NVRAM_vlan1hwname="et0"
+ NVRAM_vlan2hwname="et0"
+
remap () {
- eval $1=\"$(nvram_get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
+ eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
}
- remap lan_ifname
- remap lan_ifnames
- remap wifi_ifname
- remap wifi_ifnames
- remap wan_ifname
- remap wan_ifnames
- remap pppoe_ifname
+ for type in lan wifi wan pppoe
+ do
+ remap ${type}_ifname
+ remap ${type}_ifnames
+ done
+}
+
+# hacks for wap54g hardware
+[ "$(nvram get boardnum)" = "2" ] || \
+[ "$(nvram get boardnum)" = "1024" ] && {
+ debug "### wap54g hack ###"
+ NVRAM_wan_ifname="none"
}
-[ -z "$(nvram_get lan_ifname)" ] && {
- lan_ifname="br0"
- lan_ifnames="vlan0 vlan2 eth1 eth2 eth3"
+# defaults if lan_ifname is missing
+[ -z "$(nvram get lan_ifname)" ] && {
+ NVRAM_lan_ifname="br0"
+ NVRAM_lan_ifnames="vlan0 vlan2 eth1 eth2 eth3"
}
-[ -z "$(nvram_get wan_ifname)" ] && {
- wan_ifname="vlan1"
- wan_proto="dhcp"
+# defaults if wan_ifname is missing
+[ -z "$(nvram get wan_ifname)" ] && {
+ NVRAM_wan_ifname="vlan1"
+ NVRAM_wan_proto="dhcp"
}
# failsafe if reset is held
[ "$FAILSAFE" = "true" ] && {
echo "### FAILSAFE MODE ####"
- lan_ifname="br0"
- lan_ifnames="vlan0 vlan2 eth1 eth2 eth3"
- lan_ipaddr="192.168.1.1"
- lan_netmask="255.255.255.0"
- lan_hwaddr="00:0B:AD:0A:DD:00"
- wan_ifname="none"
- wifi_ifname="none"
+ NVRAM_lan_ifname="br0"
+ NVRAM_lan_ifnames="vlan0 vlan2 eth1 eth2 eth3"
+ NVRAM_lan_ipaddr="192.168.1.1"
+ NVRAM_lan_netmask="255.255.255.0"
+ NVRAM_lan_hwaddr="00:0B:AD:0A:DD:00"
+ NVRAM_wan_ifname="none"
+ NVRAM_wifi_ifname="none"
}
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/preinit b/obsolete-buildroot/sources/openwrt/root/etc/preinit
index 748b6067d..1500f194e 100755
--- a/obsolete-buildroot/sources/openwrt/root/etc/preinit
+++ b/obsolete-buildroot/sources/openwrt/root/etc/preinit
@@ -1,17 +1,19 @@
#!/bin/sh
+# executed from squashfs before init to
+# transfer root to the jffs2 partition
mount none /proc -t proc
insmod diag
echo 0x01 > /proc/sys/diag
sleep 1
-if [ $(cat /proc/sys/reset) = 0 ] ; then
+if [ $(cat /proc/sys/reset) = 1 ] ; then
+ export FAILSAFE=true
+else
mtd unlock mtd4
mount -t jffs2 /dev/mtdblock/4 /jffs
pivot_root /jffs /jffs/rom
mount none /dev -t devfs
mount none /proc -t proc
umount rom/proc rom/dev
-else
- export FAILSAFE=true
fi
mount none /tmp -t ramfs
exec /sbin/init
diff --git a/obsolete-buildroot/sources/openwrt/root/etc/profile b/obsolete-buildroot/sources/openwrt/root/etc/profile
index 68adf5471..fdccce1d4 100644
--- a/obsolete-buildroot/sources/openwrt/root/etc/profile
+++ b/obsolete-buildroot/sources/openwrt/root/etc/profile
@@ -4,5 +4,5 @@
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PS1='\u@\h:\w\$ '
-alias less='more'
-alias vim='vi'
+alias less=more
+alias vim=vi