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/boot22
-rw-r--r--package/base-files/src/etc/init.d/fs20
-rw-r--r--package/base-files/src/etc/init.d/fsnet53
-rw-r--r--package/base-files/src/etc/init.d/mount10
-rwxr-xr-xpackage/base-files/src/etc/init.d/rcS11
-rwxr-xr-xpackage/base-files/src/etc/init.d/umount14
6 files changed, 101 insertions, 29 deletions
diff --git a/package/base-files/src/etc/init.d/boot b/package/base-files/src/etc/init.d/boot
index df2c493d7..fc2f79ac2 100644
--- a/package/base-files/src/etc/init.d/boot
+++ b/package/base-files/src/etc/init.d/boot
@@ -4,6 +4,26 @@
. /etc/functions.sh
+# remount /dev with smaller size
+mount -o remount,nosuid,size=128k,mode=0755 -t tmpfs mdev /dev
+
+# remount /tmp with smaller size
+size=$(cat /etc/tmpfs 2>/dev/null)
+[ -z $size ] && size=2048
+mount -o remount,nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp
+
+# start mdev dynamic device node management
+echo >/dev/mdev.seq
+echo "/sbin/mdev" >/proc/sys/kernel/hotplug
+mdev -s
+
+# seed some random
+cat /etc/.rnd >/dev/urandom 2>&1
+
+# setup cfgfs
+[ -x /sbin/cfgfs ] && { cfgfs setup; mount -o remount,ro /;} || mount -o remount,rw /
+
+# create some useful directories in tmpfs
mkdir -p /var/log
mkdir -p /var/run
touch /var/log/lastlog
@@ -22,6 +42,4 @@ 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/fs b/package/base-files/src/etc/init.d/fs
new file mode 100644
index 000000000..75ae760e0
--- /dev/null
+++ b/package/base-files/src/etc/init.d/fs
@@ -0,0 +1,20 @@
+#!/bin/sh
+#INIT 60
+[[ $1 = autostart ]] || exit 0
+
+# mount net filesystems (nfs/cifs)
+grep nfs /proc/filesystems >/dev/null 2>&1
+if [ $? -eq 0 ];then
+ grep -v "^#" /etc/fstab| grep nfs >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mount -a -t nfs
+ fi
+fi
+grep cifs /proc/filesystems >/dev/null 2>&1
+if [ $? -eq 0 ];then
+ grep -v "^#" /etc/fstab| grep cifs >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mount -a -t cifs
+ fi
+fi
+exit 0
diff --git a/package/base-files/src/etc/init.d/fsnet b/package/base-files/src/etc/init.d/fsnet
new file mode 100644
index 000000000..8f4397897
--- /dev/null
+++ b/package/base-files/src/etc/init.d/fsnet
@@ -0,0 +1,53 @@
+#!/bin/sh
+#INIT 20
+[[ $1 = autostart ]] || exit 0
+
+# activate swap
+[ -x /sbin/swapon ] && { swapon -a; }
+
+# activate any logical volumes
+[ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay; }
+
+# filesystem checks
+[ -x /sbin/fsck.ext2 ] && {
+ for i in $(grep -v "^#" /etc/fstab|grep ext2|awk '{ print $1}');do fsck.ext2 $i;done;
+}
+[ -x /sbin/fsck.ext3 ] && {
+ for i in $(grep -v "^#" /etc/fstab|grep ext3|awk '{ print $1}');do fsck.ext3 $i;done;
+}
+[ -x /sbin/fsck.ext4 ] && {
+ for i in $(grep -v "^#" /etc/fstab|grep ext4|awk '{ print $1}');do fsck.ext4 $i;done;
+}
+[ -x /sbin/fsck.xfs ] && {
+ for i in $(grep -v "^#" /etc/fstab|grep xfs|awk '{ print $1}');do xfs_repair $i;done;
+}
+# local filesystems
+grep ext2 /proc/filesystems >/dev/null 2>&1
+if [ $? -eq 0 ];then
+ grep -v "^#" /etc/fstab |grep ext2 >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mount -a -t ext2
+ fi
+fi
+grep ext3 /proc/filesystems >/dev/null 2>&1
+if [ $? -eq 0 ];then
+ grep -v "^#" /etc/fstab |grep ext3 >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mount -a -t ext3
+ fi
+fi
+grep ext4 /proc/filesystems >/dev/null 2>&1
+if [ $? -eq 0 ];then
+ grep -v "^#" /etc/fstab |grep ext4 >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mount -a -t ext4
+ fi
+fi
+grep xfs /proc/filesystems >/dev/null 2>&1
+if [ $? -eq 0 ];then
+ grep -v "^#" /etc/fstab |grep xfs >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mount -a -t xfs
+ fi
+fi
+exit 0
diff --git a/package/base-files/src/etc/init.d/mount b/package/base-files/src/etc/init.d/mount
deleted file mode 100644
index 6c59d7bab..000000000
--- a/package/base-files/src/etc/init.d/mount
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-#INIT 60
-[[ $1 = autostart ]] || exit 0
-
-# any lvm volumes to activate?
-[ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay;}
-# check and mount all filesystems not /
-[ -f /etc/fstab ] && { fsck -p >/dev/null; mount -a; swapon -a;}
-
-exit 0
diff --git a/package/base-files/src/etc/init.d/rcS b/package/base-files/src/etc/init.d/rcS
index 55c86729c..9daa8f5cd 100755
--- a/package/base-files/src/etc/init.d/rcS
+++ b/package/base-files/src/etc/init.d/rcS
@@ -1,10 +1,15 @@
#!/bin/sh
+# disable kernel messages
+if [ -f /proc/sys/kernel/printk ];then
+ echo 0 > /proc/sys/kernel/printk
+fi
+echo "System initialization ..."
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ln -s /proc/self/fd/2 /dev/stderr
{
grep '^#INIT ' /etc/init.d/* | \
sort -nk2 | \
while read line; do
- sh ${line%%:*} autostart 2>&1
+ sh ${line%%:*} autostart
done
- test -e /etc/init.d/boot.local && (/bin/sh /etc/init.d/boot.local) 2>&1
-} | logger -p 6 -t '' &
+} | tee /dev/stderr |logger -p 6 -t ''
diff --git a/package/base-files/src/etc/init.d/umount b/package/base-files/src/etc/init.d/umount
deleted file mode 100755
index 49bd5a020..000000000
--- a/package/base-files/src/etc/init.d/umount
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#INIT 55
-
-case $1 in
-autostop)
- cd /
- sync
- for i in $(grep -v ^# /etc/fstab 2>/dev/null|awk '{ print $2 }'|grep -v none);do
- umount $i 2>/dev/null
- done
- ;;
-esac
-exit 0
-