summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/src/etc/init.d')
-rw-r--r--package/base-files/src/etc/init.d/boot29
-rw-r--r--package/base-files/src/etc/init.d/done4
-rwxr-xr-xpackage/base-files/src/etc/init.d/rcK21
-rwxr-xr-xpackage/base-files/src/etc/init.d/rcS10
4 files changed, 64 insertions, 0 deletions
diff --git a/package/base-files/src/etc/init.d/boot b/package/base-files/src/etc/init.d/boot
new file mode 100644
index 000000000..2ef6538e0
--- /dev/null
+++ b/package/base-files/src/etc/init.d/boot
@@ -0,0 +1,29 @@
+#!/bin/sh
+#INIT 10
+[[ $1 = autostart ]] || exit 0
+
+. /etc/functions.sh
+
+mkdir -p /var/log
+mkdir -p /var/run
+touch /var/log/lastlog
+touch /var/log/wtmp
+ln -s /var/tmp /tmp
+
+echo 0 > /proc/sys/kernel/printk
+
+HOSTNAME=
+[[ -s /etc/hostname ]] && HOSTNAME=$(cat /etc/hostname)
+HOSTNAME=${HOSTNAME%%.*}
+echo ${HOSTNAME:=linux} >/proc/sys/kernel/hostname
+
+chown 0:0 /tmp; chmod 1777 /tmp
+
+load_modules /etc/modules
+for f in /etc/modules.d/*; do
+ [[ -e $f ]] && load_modules /etc/modules.d/*
+ break
+done
+# settle down, after module load
+sleep 2
+exit 0
diff --git a/package/base-files/src/etc/init.d/done b/package/base-files/src/etc/init.d/done
new file mode 100644
index 000000000..e5b655bb6
--- /dev/null
+++ b/package/base-files/src/etc/init.d/done
@@ -0,0 +1,4 @@
+#!/bin/sh
+#INIT 98
+[[ $1 = autostart ]] && sysctl -p >&-
+exit 0
diff --git a/package/base-files/src/etc/init.d/rcK b/package/base-files/src/etc/init.d/rcK
new file mode 100755
index 000000000..e94d1a296
--- /dev/null
+++ b/package/base-files/src/etc/init.d/rcK
@@ -0,0 +1,21 @@
+#!/bin/sh
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+busybox reboot -d 60 -f & # just in caseā€¦
+{
+ [[ -f /proc/diag/led/power ]] && echo f >/proc/diag/led/power
+ test -e /etc/rc.shutdown && (/bin/sh /etc/rc.shutdown) 2>&1
+ grep '^#INIT ' /etc/init.d/* | \
+ sort -rnk2 | \
+ while read line; do
+ shebang=$(sed -n '1s/^#![ ]*//p' ${line%%:*})
+ case $shebang in
+ *[\ \ ]*) shebang=\'$(echo X"$shebang" | sed \
+ -e 's/^X//' -e "s/'/'\\\\''/g" \
+ -e 's/^\([^ ][^ ]*\)[ ]*$/\1/' \
+ -e 's/^\([^ ][^ ]*\)[ ][ ]*\(..*\)$/\1 \2/' \
+ -e 's/^\([^ ][^ ]*\) /\1'\'' '\''/')\' ;;
+ esac
+ ${shebang:-/bin/sh} ${line%%:*} autostop 2>&1
+ done
+ [[ -f /proc/diag/led/power ]] && echo 0 >/proc/diag/led/power
+} | logger -s -p 6 -t ''
diff --git a/package/base-files/src/etc/init.d/rcS b/package/base-files/src/etc/init.d/rcS
new file mode 100755
index 000000000..fd56feebf
--- /dev/null
+++ b/package/base-files/src/etc/init.d/rcS
@@ -0,0 +1,10 @@
+#!/bin/sh
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+{
+ grep '^#INIT ' /etc/init.d/* | \
+ sort -nk2 | \
+ while read line; do
+ /bin/sh ${line%%:*} autostart 2>&1
+ done
+ test -e /etc/init.d/boot.local && (/bin/sh /etc/init.d/boot.local) 2>&1
+} | logger -s -p 6 -t '' &