Changeset 155


Ignore:
Timestamp:
2004-09-07T07:54:07+02:00 (13 years ago)
Author:
mbm
Message:

wap54g support
separate S50services into individual files
move nvram_get to 'nvram get' making nvram overrides more transparent

Location:
trunk/obsolete-buildroot/sources/openwrt/root
Files:
3 added
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/functions.sh

    r134 r155  
    44 
    55# allow env to override nvram 
    6 nvram_get () { 
    7  eval "echo \${$1:-\$(nvram get $1)}" 
     6nvram () { 
     7  case $1 in 
     8    get) eval "echo \${NVRAM_$2:-\$(command nvram get $2)}";; 
     9    *) command nvram $*;; 
     10  esac 
    811} 
    912. /etc/nvram.overrides 
     
    1316  [ "${1%%[0-9]}" = "vlan" ] && { 
    1417    i=${1#vlan} 
    15     hwname=$(nvram_get vlan${i}hwname) 
    16     hwaddr=$(nvram_get ${hwname}macaddr) 
     18    hwname=$(nvram get vlan${i}hwname) 
     19    hwaddr=$(nvram get ${hwname}macaddr) 
    1720    [ -z "$hwaddr" ] && return 1 
    1821 
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/init.d/S10boot

    r136 r155  
    11#!/bin/sh 
     2syslogd -C 16  
    23sysctl -p 
    34echo "S" > /proc/jffs2_bbc 
     
    56mkdir -p /var/run 
    67 
    7 # networking stub 
    88[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && { 
    9   # force unique wireless mac 
     9  # if default wifi mac, set two higher than the lan mac 
    1010  nvram set il0macaddr=$(nvram get et0macaddr| 
    11   awk '{OFS=FS=":";for(x=6,y=2;x;x--){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') 
     11  awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') 
    1212} 
    1313 
     
    1919 
    2020HOSTNAME=$(nvram get wan_hostname) 
    21 DOMAINNAME=${HOSTNAME##*.} 
    2221HOSTNAME=${HOSTNAME%%.*} 
    23  
    2422echo ${HOSTNAME:=OpenWrt} > /proc/sys/kernel/hostname 
    25 echo ${DOMAINNAME:=lan}   > /proc/sys/kernel/domainname 
    2623 
    2724vconfig set_name_type VLAN_PLUS_VID_NO_PAD 
    28  
    29 syslogd -C 16  
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/init.d/S40network

    r134 r155  
    88    wifi up 
    99 
    10     for route in $(nvram_get static_route); do { 
     10    for route in $(nvram get static_route); do { 
    1111      eval "set $(echo $route | sed 's/:/ /g')" 
    12       route add -net $1 netmask $2 gw $3 metric $4 dev $5 
     12      $DEBUG route add -net $1 netmask $2 gw $3 metric $4 dev $5 
    1313    } done 
    1414    ;; 
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/init.d/S45firewall

    r134 r155  
    22. /etc/functions.sh 
    33 
    4 WAN=$(nvram_get wan_ifname) 
     4WAN=$(nvram get wan_ifname) 
    55 
    66IPT=/usr/sbin/iptables 
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/init.d/S99done

    r134 r155  
    11#!/bin/sh 
     2# automagically run firstboot 
    23[ -z "$FAILSAFE" ] && { 
    34        { mount | grep jffs2 1>&-; } || firstboot 
    45} 
    5 # turn off DMZ led 
     6# set leds to normal state 
    67echo "0x00" > /proc/sys/diag 
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/ipkg.conf

    r134 r155  
    1 src openwrt http://openwrt.ksilebo.net/ipkg 
     1src openwrt http://openwrt.org/ipkg 
    22dest root / 
    33dest ram /tmp 
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/nvram.overrides

    r147 r155  
    11# NVRAM overrides 
     2# 
    23# This file handles the NVRAM quirks of various hardware. 
    3 # 
    44# THIS FILE IS NOT A REPLACEMENT FOR NVRAM 
    55 
    6 # linksys bug has lan doing dhcp; force static 
    7 lan_proto="static" 
     6# linksys bug; remove when not using static configuration for lan 
     7NVRAM_lan_proto="static" 
    88 
    9 # hacks for 1.x hardware 
     9# hacks for wrt54g 1.x hardware 
    1010[ "$(nvram get boardnum)"  = "42" ] && \ 
    1111[ "$(nvram get boardtype)" = "bcm94710dev" ] && { 
    12   debug "### 1.x hardware hack ###" 
    13   vlan1hwname="et0" 
    14   vlan2hwname="et0" 
    1512 
    16   # we remap old device names to new 
    17   # it's recommended that you continue to 
    18   # use the old names to preserve backwards 
    19   # compatibility 
     13  # remap eth0 => vlan2, eth1 => vlan1 
     14  # for all *_ifname(s) 
     15 
     16  debug "### wrt54g 1.x hack ###" 
     17  NVRAM_vlan1hwname="et0" 
     18  NVRAM_vlan2hwname="et0" 
     19 
    2020  remap () { 
    21     eval $1=\"$(nvram_get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\" 
     21    eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\" 
    2222  } 
    2323 
    24   remap lan_ifname 
    25   remap lan_ifnames 
    26   remap wifi_ifname 
    27   remap wifi_ifnames 
    28   remap wan_ifname 
    29   remap wan_ifnames 
    30   remap pppoe_ifname 
     24  for type in lan wifi wan pppoe 
     25  do 
     26  remap ${type}_ifname 
     27  remap ${type}_ifnames 
     28  done 
    3129} 
    3230 
    33 [ -z "$(nvram_get lan_ifname)" ] && { 
    34   lan_ifname="br0" 
    35   lan_ifnames="vlan0 vlan2 eth1 eth2 eth3" 
     31# hacks for wap54g hardware 
     32[ "$(nvram get boardnum)"  = "2" ] || \ 
     33[ "$(nvram get boardnum)"  = "1024" ] && { 
     34  debug "### wap54g hack ###" 
     35  NVRAM_wan_ifname="none" 
    3636} 
    3737 
    38 [ -z "$(nvram_get wan_ifname)" ] && { 
    39    wan_ifname="vlan1" 
    40    wan_proto="dhcp" 
     38# defaults if lan_ifname is missing 
     39[ -z "$(nvram get lan_ifname)" ] && { 
     40  NVRAM_lan_ifname="br0" 
     41  NVRAM_lan_ifnames="vlan0 vlan2 eth1 eth2 eth3" 
     42} 
     43 
     44# defaults if wan_ifname is missing 
     45[ -z "$(nvram get wan_ifname)" ] && { 
     46   NVRAM_wan_ifname="vlan1" 
     47   NVRAM_wan_proto="dhcp" 
    4148} 
    4249 
     
    4451[ "$FAILSAFE" = "true" ] && { 
    4552  echo "### FAILSAFE MODE ####" 
    46   lan_ifname="br0" 
    47   lan_ifnames="vlan0 vlan2 eth1 eth2 eth3" 
    48   lan_ipaddr="192.168.1.1" 
    49   lan_netmask="255.255.255.0" 
    50   lan_hwaddr="00:0B:AD:0A:DD:00" 
    51   wan_ifname="none" 
    52   wifi_ifname="none" 
     53  NVRAM_lan_ifname="br0" 
     54  NVRAM_lan_ifnames="vlan0 vlan2 eth1 eth2 eth3" 
     55  NVRAM_lan_ipaddr="192.168.1.1" 
     56  NVRAM_lan_netmask="255.255.255.0" 
     57  NVRAM_lan_hwaddr="00:0B:AD:0A:DD:00" 
     58  NVRAM_wan_ifname="none" 
     59  NVRAM_wifi_ifname="none" 
    5360} 
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/preinit

    r151 r155  
    11#!/bin/sh 
     2# executed from squashfs before init to  
     3# transfer root to the jffs2 partition 
    24mount none /proc -t proc 
    35insmod diag 
    46echo 0x01 > /proc/sys/diag 
    57sleep 1 
    6 if [ $(cat /proc/sys/reset) = 0 ] ; then 
     8if [ $(cat /proc/sys/reset) = 1 ] ; then 
     9  export FAILSAFE=true 
     10else 
    711  mtd unlock mtd4 
    812  mount -t jffs2 /dev/mtdblock/4 /jffs 
     
    1115  mount none /proc -t proc 
    1216  umount rom/proc rom/dev 
    13 else 
    14   export FAILSAFE=true 
    1517fi 
    1618mount none /tmp -t ramfs 
  • trunk/obsolete-buildroot/sources/openwrt/root/etc/profile

    r134 r155  
    55export PS1='\u@\h:\w\$ ' 
    66 
    7 alias less='more' 
    8 alias vim='vi' 
     7alias less=more 
     8alias vim=vi 
  • trunk/obsolete-buildroot/sources/openwrt/root/sbin/ifdown

    r134 r155  
    33  type=$1 
    44  debug "### ifdown $type ###" 
    5   if=$(nvram_get ${type}_ifname) 
     5  if=$(nvram get ${type}_ifname) 
    66  if_valid $if || return 
    77  kill $(cat /var/run/${if}.pid 2>&-) 2>&- 
  • trunk/obsolete-buildroot/sources/openwrt/root/sbin/ifup

    r134 r155  
    44  debug "### ifup $type ###" 
    55 
    6   if=$(nvram_get ${type}_ifname) 
     6  if=$(nvram get ${type}_ifname) 
    77  if [ "${if%%[0-9]}" = "ppp" ]; then 
    8     if=$(nvram_get pppoe_ifname) 
     8    if=$(nvram get pppoe_ifname) 
    99  fi 
    1010 
     
    1313  $DEBUG ifconfig $if down 
    1414  if [ "${if%%[0-9]}" = "br" ]; then 
    15     stp=$(nvram_get ${type}_stp) 
     15    stp=$(nvram get ${type}_stp) 
    1616    $DEBUG brctl delbr $if 
    1717    $DEBUG brctl addbr $if 
    1818    $DEBUG brctl setfd $if 0 
    1919    $DEBUG brctl stp $if ${stp:-0} 
    20     for sif in $(nvram_get ${type}_ifnames); do { 
     20    for sif in $(nvram get ${type}_ifnames); do { 
    2121      if_valid $sif || continue 
    2222      $DEBUG ifconfig $sif 0.0.0.0 up 
     
    2525  fi 
    2626 
    27   mac=$(nvram_get ${type}_hwaddr) 
     27  mac=$(nvram get ${type}_hwaddr) 
    2828  ${mac:+$DEBUG ifconfig $if hw ether $mac} 
    2929 
    30   if_proto=$(nvram_get ${type}_proto) 
     30  if_proto=$(nvram get ${type}_proto) 
    3131  case "$if_proto" in 
    3232    static) 
    33       ip=$(nvram_get ${type}_ipaddr) 
    34       netmask=$(nvram_get ${type}_netmask) 
    35       gateway=$(nvram_get ${type}_gateway) 
     33      ip=$(nvram get ${type}_ipaddr) 
     34      netmask=$(nvram get ${type}_netmask) 
     35      gateway=$(nvram get ${type}_gateway) 
    3636 
    3737      $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up 
     
    4141 
    4242      debug "# --- creating /etc/resolv.conf ---" 
    43       for dns in $(nvram_get ${type}_dns); do { 
     43      for dns in $(nvram get ${type}_dns); do { 
    4444        echo "nameserver $dns" >> /etc/resolv.conf 
    4545      } done 
     
    5353    ;; 
    5454    pppoe) 
    55       username=$(nvram_get ppp_username) 
    56       password=$(nvram_get ppp_passwd) 
    57       redial=$(nvram_get ppp_redialperiod) 
    58       idletime=$(nvram_get ppp_idletime) 
    59       mtu=$(nvram_get wan_mtu) 
     55      username=$(nvram get ppp_username) 
     56      password=$(nvram get ppp_passwd) 
     57      redial=$(nvram get ppp_redialperiod) 
     58      idletime=$(nvram get ppp_idletime) 
     59      mtu=$(nvram get wan_mtu) 
    6060 
    6161      $DEBUG ifconfig $if 0.0.0.0 up 
  • trunk/obsolete-buildroot/sources/openwrt/root/sbin/wifi

    r134 r155  
    11#!/bin/ash 
    2   alias debug=${DEBUG:-:} 
    3   debug "### wifi $1 ###" 
    4   if=$(awk 'sub(":","") {print $1}' /proc/net/wireless) 
    5   $DEBUG wlconf $if $1 
     2alias debug=${DEBUG:-:} 
     3debug "### wifi $1 ###" 
     4if=$(awk 'sub(":","") {print $1}' /proc/net/wireless) 
     5$DEBUG wlconf $if $1 
Note: See TracChangeset for help on using the changeset viewer.