diff options
Diffstat (limited to 'package/base-files/src')
-rw-r--r-- | package/base-files/src/etc/fstab | 8 | ||||
-rw-r--r-- | package/base-files/src/etc/group | 9 | ||||
-rw-r--r-- | package/base-files/src/etc/init.d/boot | 22 | ||||
-rw-r--r-- | package/base-files/src/etc/init.d/fs | 20 | ||||
-rw-r--r-- | package/base-files/src/etc/init.d/fsnet | 53 | ||||
-rw-r--r-- | package/base-files/src/etc/init.d/mount | 10 | ||||
-rwxr-xr-x | package/base-files/src/etc/init.d/rcS | 11 | ||||
-rwxr-xr-x | package/base-files/src/etc/init.d/umount | 14 | ||||
-rw-r--r-- | package/base-files/src/etc/inittab | 8 | ||||
-rwxr-xr-x | package/base-files/src/etc/network/if-post-down.d/03-wireless | 1 | ||||
-rw-r--r-- | package/base-files/src/etc/profile | 1 | ||||
-rwxr-xr-x | package/base-files/src/init | 31 |
12 files changed, 130 insertions, 58 deletions
diff --git a/package/base-files/src/etc/fstab b/package/base-files/src/etc/fstab new file mode 100644 index 000000000..5c09c2510 --- /dev/null +++ b/package/base-files/src/etc/fstab @@ -0,0 +1,8 @@ +# /etc/fstab: static file system information. +# +# <file system> <mount pt> <type> <options> <dump> <pass> +proc /proc proc defaults 0 0 +devpts /dev/pts devpts defaults,gid=5,mode=620 0 0 +tmpfs /dev/shm tmpfs mode=0777 0 0 +tmpfs /tmp tmpfs mode=1777 0 0 +sysfs /sys sysfs defaults 0 0 diff --git a/package/base-files/src/etc/group b/package/base-files/src/etc/group index bbf6c0603..51d78238c 100644 --- a/package/base-files/src/etc/group +++ b/package/base-files/src/etc/group @@ -1,4 +1,9 @@ root:x:0: -video:x:1: -audio:x:2: +daemon:x:1: +bin:x:2: +sys:x:3: +adm:x:4: +tty:x:5: +video:x:6: +audio:x:7: nogroup:x:65534: 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 - diff --git a/package/base-files/src/etc/inittab b/package/base-files/src/etc/inittab index 79e69d931..f6183798e 100644 --- a/package/base-files/src/etc/inittab +++ b/package/base-files/src/etc/inittab @@ -1,2 +1,10 @@ +null::sysinit:/bin/mount -t proc proc /proc +null::sysinit:/bin/mount -t sysfs sys /sys +null::sysinit:/bin/mkdir -p /dev/pts +null::sysinit:/bin/mkdir -p /dev/shm +null::sysinit:/bin/mount -a -t devpts +null::sysinit:/bin/mount -a -t tmpfs ::sysinit:/etc/init.d/rcS ::shutdown:/etc/init.d/rcK +null::shutdown:/bin/umount -a -r +null::shutdown:/sbin/swapoff -a diff --git a/package/base-files/src/etc/network/if-post-down.d/03-wireless b/package/base-files/src/etc/network/if-post-down.d/03-wireless index 67c01714e..77bca475b 100755 --- a/package/base-files/src/etc/network/if-post-down.d/03-wireless +++ b/package/base-files/src/etc/network/if-post-down.d/03-wireless @@ -1,5 +1,4 @@ #!/bin/sh -set -x set -e [ "${IFACE%%[0-9]*}" = "wlan" ] || exit 0 diff --git a/package/base-files/src/etc/profile b/package/base-files/src/etc/profile index 96f03b980..ce425b54c 100644 --- a/package/base-files/src/etc/profile +++ b/package/base-files/src/etc/profile @@ -1,5 +1,4 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin -export TERM=linux export EDITOR=/bin/vi if [[ $(id -u) = 0 ]]; then export PS1='`whoami`@`hostname`:`pwd` # ' diff --git a/package/base-files/src/init b/package/base-files/src/init index ad519e96d..a27548217 100755 --- a/package/base-files/src/init +++ b/package/base-files/src/init @@ -1,26 +1,7 @@ #!/bin/sh -echo "System initialization ..." -export PATH=/bin:/sbin:/usr/bin:/usr/sbin -mount -t devtmpfs devtmpfs /dev >/dev/null 2>&1 -mount -nt proc proc /proc -echo 0 > /proc/sys/kernel/printk -mount -o nosuid,nodev,noexec -t sysfs sysfs /sys -[ ! -f /etc/notmpfs ] && { - size=$(cat /etc/tmpfs 2>/dev/null) - [ -z $size ] && size=2048 - mount -o nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp -} -mount -o remount,nosuid,size=128k,mode=0755 -t tmpfs mdev /dev -[ -d /dev/pts ] || mkdir /dev/pts -[ -d /dev/shm ] || mkdir /dev/shm -mount -o nosuid,noexec -t tmpfs tmpfs /dev/shm -mount -o nosuid,noexec -t devpts devpts /dev/pts -echo >/dev/mdev.seq -echo "/sbin/mdev" >/proc/sys/kernel/hotplug -mdev -s -cat /etc/.rnd >/dev/urandom 2>&1 -[ -x /installer ] && { /installer; } -[ -x /kexecinit ] && { /kexecinit; } -[ -x /cryptinit ] && { /cryptinit; exec switch_root /mnt "/init";} -[ -x /sbin/cfgfs ] && { cfgfs setup; mount -o remount,ro /;} || mount -o remount,rw / -exec /sbin/init +# devtmpfs does not get automounted for initramfs +/bin/mount -t devtmpfs devtmpfs /dev +exec 0</dev/console +exec 1>/dev/console +exec 2>/dev/console +exec /sbin/init $* |