summaryrefslogtreecommitdiff
path: root/openwrt/package/base-files/default/etc/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/package/base-files/default/etc/init.d')
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/S10boot9
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/S40network16
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/S45firewall96
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/S50telnet2
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/S60cron8
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/S98done9
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/S99done4
-rwxr-xr-xopenwrt/package/base-files/default/etc/init.d/rcS10
8 files changed, 21 insertions, 133 deletions
diff --git a/openwrt/package/base-files/default/etc/init.d/S10boot b/openwrt/package/base-files/default/etc/init.d/S10boot
index 02fddee..0cc519d 100755
--- a/openwrt/package/base-files/default/etc/init.d/S10boot
+++ b/openwrt/package/base-files/default/etc/init.d/S10boot
@@ -1,14 +1,9 @@
#!/bin/sh
-. /etc/nvram.sh
-
-[ "$(uname -r|grep -c 2.4)" = "1" ] && {
- echo "S" > /proc/jffs2_bbc
-}
+[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
-HOSTNAME=$(nvram get wan_hostname)
-HOSTNAME=${HOSTNAME%%.*}
+HOSTNAME=${wan_hostname%%.*}
echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname
mkdir -p /var/run
diff --git a/openwrt/package/base-files/default/etc/init.d/S40network b/openwrt/package/base-files/default/etc/init.d/S40network
deleted file mode 100755
index 168fd29..0000000
--- a/openwrt/package/base-files/default/etc/init.d/S40network
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-. /etc/functions.sh
-[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network
-case "$1" in
- 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
diff --git a/openwrt/package/base-files/default/etc/init.d/S45firewall b/openwrt/package/base-files/default/etc/init.d/S45firewall
deleted file mode 100755
index 8c67d82..0000000
--- a/openwrt/package/base-files/default/etc/init.d/S45firewall
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/sh
-
-## Please make changes in /etc/firewall.user
-${FAILSAFE:+exit}
-
-. /etc/functions.sh
-. /etc/network.overrides
-[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network
-
-WAN=$(nvram get wan_ifname)
-LAN=$(nvram get lan_ifname)
-
-## CLEAR TABLES
-for T in filter nat; do
- iptables -t $T -F
- iptables -t $T -X
-done
-
-iptables -N input_rule
-iptables -N output_rule
-iptables -N forwarding_rule
-
-iptables -t nat -N prerouting_rule
-iptables -t nat -N postrouting_rule
-
-### INPUT
-### (connections with the router as destination)
-
- # base case
- iptables -P INPUT DROP
- iptables -A INPUT -m state --state INVALID -j DROP
- iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A INPUT -p tcp --tcp-flags SYN SYN --tcp-option \! 2 -j DROP
-
- #
- # insert accept rule or to jump to new accept-check table here
- #
- iptables -A INPUT -j input_rule
-
- # allow
- iptables -A INPUT ${WAN:+-i \! $WAN} -j ACCEPT # allow from lan/wifi interfaces
- iptables -A INPUT -p icmp -j ACCEPT # allow ICMP
- iptables -A INPUT -p gre -j ACCEPT # allow GRE
-
- # reject (what to do with anything not allowed earlier)
- iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset
- iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable
-
-### OUTPUT
-### (connections with the router as source)
-
- # base case
- iptables -P OUTPUT DROP
- iptables -A OUTPUT -m state --state INVALID -j DROP
- iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-
- #
- # insert accept rule or to jump to new accept-check table here
- #
- iptables -A OUTPUT -j output_rule
-
- # allow
- iptables -A OUTPUT -j ACCEPT #allow everything out
-
- # reject (what to do with anything not allowed earlier)
- iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset
- iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable
-
-### FORWARDING
-### (connections routed through the router)
-
- # base case
- iptables -P FORWARD DROP
- iptables -A FORWARD -m state --state INVALID -j DROP
- iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
- iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-
- #
- # insert accept rule or to jump to new accept-check table here
- #
- iptables -A FORWARD -j forwarding_rule
-
- # allow
- iptables -A FORWARD -i br0 -o br0 -j ACCEPT
- [ -z "$WAN" ] || iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT
-
- # reject (what to do with anything not allowed earlier)
- # uses the default -P DROP
-
-### MASQ
- iptables -t nat -A PREROUTING -j prerouting_rule
- iptables -t nat -A POSTROUTING -j postrouting_rule
- [ -z "$WAN" ] || iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
-
-## USER RULES
-[ -f /etc/firewall.user ] && . /etc/firewall.user
diff --git a/openwrt/package/base-files/default/etc/init.d/S50telnet b/openwrt/package/base-files/default/etc/init.d/S50telnet
index ff5659e..fb9687c 100755
--- a/openwrt/package/base-files/default/etc/init.d/S50telnet
+++ b/openwrt/package/base-files/default/etc/init.d/S50telnet
@@ -1,2 +1,2 @@
#!/bin/sh
-if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null || test $FAILSAFE; then telnetd -l /bin/login; fi
+if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null; then telnetd -l /bin/login; fi
diff --git a/openwrt/package/base-files/default/etc/init.d/S60cron b/openwrt/package/base-files/default/etc/init.d/S60cron
index 6069b81..1752734 100755
--- a/openwrt/package/base-files/default/etc/init.d/S60cron
+++ b/openwrt/package/base-files/default/etc/init.d/S60cron
@@ -1,6 +1,4 @@
#!/bin/sh
-[ -d /etc/crontabs ] || mkdir -p /etc/crontabs
-[ -e /var/spool/cron/crontabs ] || {
- mkdir -p /var/spool/cron
- ln -s /etc/crontabs /var/spool/cron/crontabs
-} && crond -c /etc/crontabs
+mkdir -p /var/spool/cron
+ln -s /etc/crontabs /var/spool/cron/crontabs
+crond -c /etc/crontabs
diff --git a/openwrt/package/base-files/default/etc/init.d/S98done b/openwrt/package/base-files/default/etc/init.d/S98done
new file mode 100755
index 0000000..5d5ab49
--- /dev/null
+++ b/openwrt/package/base-files/default/etc/init.d/S98done
@@ -0,0 +1,9 @@
+#!/bin/sh
+sysctl -p >&-
+
+# automagically run firstboot
+{ mount|grep "on / type tmpfs" 1>&-; } && {
+ lock /tmp/.switch2jffs
+ firstboot switch2jffs
+ lock -u /tmp/.switch2jffs
+}
diff --git a/openwrt/package/base-files/default/etc/init.d/S99done b/openwrt/package/base-files/default/etc/init.d/S99done
deleted file mode 100755
index a260ac3..0000000
--- a/openwrt/package/base-files/default/etc/init.d/S99done
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# set leds to normal state
-[ -f /proc/sys/diag ] && echo "0x00" > /proc/sys/diag
-sysctl -p >&-
diff --git a/openwrt/package/base-files/default/etc/init.d/rcS b/openwrt/package/base-files/default/etc/init.d/rcS
index 10079c5..b38e449 100755
--- a/openwrt/package/base-files/default/etc/init.d/rcS
+++ b/openwrt/package/base-files/default/etc/init.d/rcS
@@ -1,8 +1,10 @@
#!/bin/sh
-. /etc/nvram.sh
-syslog_ip=$(nvram get log_ipaddr)
-ipcalc -s "$syslog_ip" || syslog_ip=""
-syslogd -C 16 ${syslog_ip:+-L -R $syslog_ip}
+${FAILSAFE:+exit}
+
+[ -f /etc/config/network ] && . /etc/config/network
+eval $(ipcalc "$log_ipaddr")
+[ "$log_ipaddr" = "$IP" ] || log_ipaddr=""
+syslogd -C 16 ${log_ipaddr:+-L -R $log_ipaddr}
klogd
#${FAILSAFE:+telnetd -l /bin/login; ifup lan; exit}
for i in /etc/init.d/S*; do