summaryrefslogtreecommitdiffstats
path: root/obsolete-buildroot/sources/openwrt
diff options
context:
space:
mode:
Diffstat (limited to 'obsolete-buildroot/sources/openwrt')
-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
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/sbin/ifdown2
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/sbin/ifup30
-rwxr-xr-xobsolete-buildroot/sources/openwrt/root/sbin/wifi8
15 files changed, 87 insertions, 77 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
diff --git a/obsolete-buildroot/sources/openwrt/root/sbin/ifdown b/obsolete-buildroot/sources/openwrt/root/sbin/ifdown
index 4c7e98211..e59e05739 100755
--- a/obsolete-buildroot/sources/openwrt/root/sbin/ifdown
+++ b/obsolete-buildroot/sources/openwrt/root/sbin/ifdown
@@ -2,7 +2,7 @@
. /etc/functions.sh
type=$1
debug "### ifdown $type ###"
- if=$(nvram_get ${type}_ifname)
+ if=$(nvram get ${type}_ifname)
if_valid $if || return
kill $(cat /var/run/${if}.pid 2>&-) 2>&-
$DEBUG ifconfig $if down
diff --git a/obsolete-buildroot/sources/openwrt/root/sbin/ifup b/obsolete-buildroot/sources/openwrt/root/sbin/ifup
index 34e19af3f..6b4a7740b 100755
--- a/obsolete-buildroot/sources/openwrt/root/sbin/ifup
+++ b/obsolete-buildroot/sources/openwrt/root/sbin/ifup
@@ -3,36 +3,36 @@
type=$1
debug "### ifup $type ###"
- if=$(nvram_get ${type}_ifname)
+ if=$(nvram get ${type}_ifname)
if [ "${if%%[0-9]}" = "ppp" ]; then
- if=$(nvram_get pppoe_ifname)
+ if=$(nvram get pppoe_ifname)
fi
if_valid $if || return
$DEBUG ifconfig $if down
if [ "${if%%[0-9]}" = "br" ]; then
- stp=$(nvram_get ${type}_stp)
+ stp=$(nvram get ${type}_stp)
$DEBUG brctl delbr $if
$DEBUG brctl addbr $if
$DEBUG brctl setfd $if 0
$DEBUG brctl stp $if ${stp:-0}
- for sif in $(nvram_get ${type}_ifnames); do {
+ for sif in $(nvram get ${type}_ifnames); do {
if_valid $sif || continue
$DEBUG ifconfig $sif 0.0.0.0 up
$DEBUG brctl addif $if $sif
} done
fi
- mac=$(nvram_get ${type}_hwaddr)
+ mac=$(nvram get ${type}_hwaddr)
${mac:+$DEBUG ifconfig $if hw ether $mac}
- if_proto=$(nvram_get ${type}_proto)
+ if_proto=$(nvram get ${type}_proto)
case "$if_proto" in
static)
- ip=$(nvram_get ${type}_ipaddr)
- netmask=$(nvram_get ${type}_netmask)
- gateway=$(nvram_get ${type}_gateway)
+ ip=$(nvram get ${type}_ipaddr)
+ netmask=$(nvram get ${type}_netmask)
+ gateway=$(nvram get ${type}_gateway)
$DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up
${gateway:+$DEBUG route add default gw $gateway}
@@ -40,7 +40,7 @@
[ -f /etc/resolv.conf ] && return
debug "# --- creating /etc/resolv.conf ---"
- for dns in $(nvram_get ${type}_dns); do {
+ for dns in $(nvram get ${type}_dns); do {
echo "nameserver $dns" >> /etc/resolv.conf
} done
;;
@@ -52,11 +52,11 @@
${DEBUG:-eval} "udhcpc -i $if -b -p $pidfile &"
;;
pppoe)
- username=$(nvram_get ppp_username)
- password=$(nvram_get ppp_passwd)
- redial=$(nvram_get ppp_redialperiod)
- idletime=$(nvram_get ppp_idletime)
- mtu=$(nvram_get wan_mtu)
+ username=$(nvram get ppp_username)
+ password=$(nvram get ppp_passwd)
+ redial=$(nvram get ppp_redialperiod)
+ idletime=$(nvram get ppp_idletime)
+ mtu=$(nvram get wan_mtu)
$DEBUG ifconfig $if 0.0.0.0 up
diff --git a/obsolete-buildroot/sources/openwrt/root/sbin/wifi b/obsolete-buildroot/sources/openwrt/root/sbin/wifi
index 03ec66e42..6360fff04 100755
--- a/obsolete-buildroot/sources/openwrt/root/sbin/wifi
+++ b/obsolete-buildroot/sources/openwrt/root/sbin/wifi
@@ -1,5 +1,5 @@
#!/bin/ash
- alias debug=${DEBUG:-:}
- debug "### wifi $1 ###"
- if=$(awk 'sub(":","") {print $1}' /proc/net/wireless)
- $DEBUG wlconf $if $1
+alias debug=${DEBUG:-:}
+debug "### wifi $1 ###"
+if=$(awk 'sub(":","") {print $1}' /proc/net/wireless)
+$DEBUG wlconf $if $1