diff options
author | mbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-02-06 00:52:16 +0000 |
---|---|---|
committer | mbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-02-06 00:52:16 +0000 |
commit | 6fa165042b07cbb6ff52d2439e79d8ffe17be4ab (patch) | |
tree | e27ce18c541d0166fa93d2d596091036835321b0 /openwrt/target/default/target_skeleton/etc/init.d | |
parent | b7edba48e2818e1d302f385c1757feca86353366 (diff) |
openwrt root filesystem
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@211 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'openwrt/target/default/target_skeleton/etc/init.d')
8 files changed, 85 insertions, 46 deletions
diff --git a/openwrt/target/default/target_skeleton/etc/init.d/S10boot b/openwrt/target/default/target_skeleton/etc/init.d/S10boot new file mode 100755 index 0000000000..81379bed4b --- /dev/null +++ b/openwrt/target/default/target_skeleton/etc/init.d/S10boot @@ -0,0 +1,25 @@ +#!/bin/sh +klogd +syslogd -C 16 +sysctl -p +echo "S" > /proc/jffs2_bbc + +mkdir -p /var/run + +[ "$(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| + awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') +} + +insmod et +insmod wl + +ifconfig lo 127.0.0.1 up +ifconfig eth0 promisc + +HOSTNAME=$(nvram get wan_hostname) +HOSTNAME=${HOSTNAME%%.*} +echo ${HOSTNAME:=OpenWrt} > /proc/sys/kernel/hostname + +vconfig set_name_type VLAN_PLUS_VID_NO_PAD diff --git a/openwrt/target/default/target_skeleton/etc/init.d/S40network b/openwrt/target/default/target_skeleton/etc/init.d/S40network index d835d9c72a..a8144a8375 100755 --- a/openwrt/target/default/target_skeleton/etc/init.d/S40network +++ b/openwrt/target/default/target_skeleton/etc/init.d/S40network @@ -1,35 +1,15 @@ #!/bin/sh -# -# Start the network.... -# - -start() { - echo "Starting network..." - /sbin/ifup -a -} -stop() { - echo -n "Stopping network..." - /sbin/ifdown -a -} -restart() { - stop - start -} - +. /etc/functions.sh case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - *) - echo $"Usage: $0 {start|stop|restart}" - exit 1 + start|restart) + ifup lan + ifup wan + ifup wifi + wifi up + + for route in $(nvram get static_route); do { + eval "set $(echo $route | sed 's/:/ /g')" + $DEBUG route add -net $1 netmask $2 gw $3 metric $4 dev $5 + } done + ;; esac - -exit $? - diff --git a/openwrt/target/default/target_skeleton/etc/init.d/S45firewall b/openwrt/target/default/target_skeleton/etc/init.d/S45firewall new file mode 100755 index 0000000000..49b9df0004 --- /dev/null +++ b/openwrt/target/default/target_skeleton/etc/init.d/S45firewall @@ -0,0 +1,23 @@ +#!/bin/sh +. /etc/functions.sh + +WAN=$(nvram get wan_ifname) + +IPT=/usr/sbin/iptables + +for T in filter nat mangle ; do + $IPT -t $T -F + $IPT -t $T -X +done + +$IPT -t filter -A INPUT -m state --state INVALID -j DROP +$IPT -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +$IPT -t filter -A INPUT -p icmp -j ACCEPT +$IPT -t filter -A INPUT -i $WAN -p tcp -j REJECT --reject-with tcp-reset +$IPT -t filter -A INPUT -i $WAN -j REJECT --reject-with icmp-port-unreachable +$IPT -t filter -A FORWARD -m state --state INVALID -j DROP +$IPT -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT +$IPT -t filter -A FORWARD -i $WAN -m state --state NEW,INVALID -j DROP +$IPT -t filter -A FORWARD -o $WAN -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu + +$IPT -t nat -A POSTROUTING -o $WAN -j MASQUERADE diff --git a/openwrt/target/default/target_skeleton/etc/init.d/S50dnsmasq b/openwrt/target/default/target_skeleton/etc/init.d/S50dnsmasq new file mode 100755 index 0000000000..995c1b6e7a --- /dev/null +++ b/openwrt/target/default/target_skeleton/etc/init.d/S50dnsmasq @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/sbin/dnsmasq diff --git a/openwrt/target/default/target_skeleton/etc/init.d/S50httpd b/openwrt/target/default/target_skeleton/etc/init.d/S50httpd new file mode 100755 index 0000000000..fd66f8032f --- /dev/null +++ b/openwrt/target/default/target_skeleton/etc/init.d/S50httpd @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/sbin/httpd -p 80 -h /www -r WRT54G Router diff --git a/openwrt/target/default/target_skeleton/etc/init.d/S50telnet b/openwrt/target/default/target_skeleton/etc/init.d/S50telnet new file mode 100755 index 0000000000..29af5040a3 --- /dev/null +++ b/openwrt/target/default/target_skeleton/etc/init.d/S50telnet @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/sbin/telnetd -l /bin/login diff --git a/openwrt/target/default/target_skeleton/etc/init.d/S99done b/openwrt/target/default/target_skeleton/etc/init.d/S99done new file mode 100755 index 0000000000..8811e99bff --- /dev/null +++ b/openwrt/target/default/target_skeleton/etc/init.d/S99done @@ -0,0 +1,7 @@ +#!/bin/sh +# automagically run firstboot +[ -z "$FAILSAFE" ] && { + { mount | grep jffs2 1>&-; } || firstboot +} +# set leds to normal state +echo "0x00" > /proc/sys/diag diff --git a/openwrt/target/default/target_skeleton/etc/init.d/rcS b/openwrt/target/default/target_skeleton/etc/init.d/rcS index de411534da..9510e941a5 100755 --- a/openwrt/target/default/target_skeleton/etc/init.d/rcS +++ b/openwrt/target/default/target_skeleton/etc/init.d/rcS @@ -1,6 +1,5 @@ #!/bin/sh - # Start all init scripts in /etc/init.d # executing them in numerical order. # @@ -10,18 +9,17 @@ for i in /etc/init.d/S??* ;do [ ! -f "$i" ] && continue case "$i" in - *.sh) - # Source shell script for speed. - ( - trap - INT QUIT TSTP - set start - . $i - ) - ;; - *) - # No sh extension, so fork subprocess. - $i start - ;; + *.sh) + # Source shell script for speed. + ( + trap - INT QUIT TSTP + set start + . $i + ) + ;; + *) + # No sh extension, so fork subprocess. + $i start + ;; esac done - |