diff options
Diffstat (limited to 'package/base-files/default/etc/init.d')
-rwxr-xr-x | package/base-files/default/etc/init.d/S10boot | 25 | ||||
-rwxr-xr-x | package/base-files/default/etc/init.d/S40network | 11 | ||||
-rwxr-xr-x | package/base-files/default/etc/init.d/S50httpd | 10 | ||||
-rwxr-xr-x | package/base-files/default/etc/init.d/S50telnet | 10 | ||||
-rwxr-xr-x | package/base-files/default/etc/init.d/S60cron | 12 | ||||
-rwxr-xr-x | package/base-files/default/etc/init.d/rcS | 26 |
6 files changed, 94 insertions, 0 deletions
diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot new file mode 100755 index 0000000000..77b5ca72d5 --- /dev/null +++ b/package/base-files/default/etc/init.d/S10boot @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + [ -f /proc/mounts ] || /sbin/mount_root + [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc + vconfig set_name_type DEV_PLUS_VID_NO_PAD + + HOSTNAME=${wan_hostname%%.*} + echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname + + mkdir -p /var/run + mkdir -p /var/log + mkdir -p /var/lock + touch /var/log/wtmp + touch /var/log/lastlog + [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe + + # manually trigger hotplug before loading modules + for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do + /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug net + done + + load_modules /etc/modules /etc/modules.d/* +} diff --git a/package/base-files/default/etc/init.d/S40network b/package/base-files/default/etc/init.d/S40network new file mode 100755 index 0000000000..be045045e7 --- /dev/null +++ b/package/base-files/default/etc/init.d/S40network @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + setup_switch() { return 0; } + + include /lib/network + setup_switch + /sbin/wifi +} + diff --git a/package/base-files/default/etc/init.d/S50httpd b/package/base-files/default/etc/init.d/S50httpd new file mode 100755 index 0000000000..a05b10c094 --- /dev/null +++ b/package/base-files/default/etc/init.d/S50httpd @@ -0,0 +1,10 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + [ -d /www ] && httpd -p 80 -h /www -r OpenWrt +} + +stop() { + killall httpd +} diff --git a/package/base-files/default/etc/init.d/S50telnet b/package/base-files/default/etc/init.d/S50telnet new file mode 100755 index 0000000000..228eac2b62 --- /dev/null +++ b/package/base-files/default/etc/init.d/S50telnet @@ -0,0 +1,10 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null; then telnetd -l /bin/login; fi +} + +stop() { + killall telnetd +} diff --git a/package/base-files/default/etc/init.d/S60cron b/package/base-files/default/etc/init.d/S60cron new file mode 100755 index 0000000000..a450c36dd2 --- /dev/null +++ b/package/base-files/default/etc/init.d/S60cron @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start () { + mkdir -p /var/spool/cron + ln -s /etc/crontabs /var/spool/cron/crontabs + crond -c /etc/crontabs +} + +stop() { + killall crond +} diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS new file mode 100755 index 0000000000..7fae7f5b05 --- /dev/null +++ b/package/base-files/default/etc/init.d/rcS @@ -0,0 +1,26 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +${FAILSAFE:+exit} + +# FIXME: add logging configuration +#[ -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 + +( + for i in /etc/init.d/S*; do + $i start 2>&1 + done + + sysctl -p >&- + + # automagically run firstboot + { mount|grep "on / type tmpfs" 1>&-; } && { + lock /tmp/.switch2jffs + firstboot switch2jffs + lock -u /tmp/.switch2jffs + } +) | logger -s -p 6 -t '' & |