From 3ae829cba98c71a4b4143f443ea65fcf370006e4 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 10 Mar 2014 17:26:29 +0100 Subject: add fs startup script for net mounts and data mount points --- package/base-files/src/etc/fstab | 1 - package/base-files/src/etc/group | 9 +++-- package/base-files/src/etc/init.d/fs | 69 ++++++++++++++++++++++++++++++++++++ package/base-files/src/etc/inittab | 4 ++- 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 package/base-files/src/etc/init.d/fs (limited to 'package/base-files/src') diff --git a/package/base-files/src/etc/fstab b/package/base-files/src/etc/fstab index fafa1d56e..5c09c2510 100644 --- a/package/base-files/src/etc/fstab +++ b/package/base-files/src/etc/fstab @@ -1,7 +1,6 @@ # /etc/fstab: static file system information. # # -#/dev/root / ext2 rw,noauto 0 1 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 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/fs b/package/base-files/src/etc/init.d/fs new file mode 100644 index 000000000..f79d9348d --- /dev/null +++ b/package/base-files/src/etc/init.d/fs @@ -0,0 +1,69 @@ +#!/bin/sh +#INIT 60 +[[ $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 ext2 /etc/fstab|awk '{ print $1}');do fsck.ext2 $i;done; +} +[ -x /sbin/fsck.ext3 ] && { + for i in $(grep ext3 /etc/fstab|awk '{ print $1}');do fsck.ext3 $i;done; +} +[ -x /sbin/fsck.ext4 ] && { + for i in $(grep ext4 /etc/fstab|awk '{ print $1}');do fsck.ext4 $i;done; +} +[ -x /sbin/fsck.xfs ] && { + for i in $(grep xfs /etc/fstab|awk '{ print $1}');do xfs_repair $i;done; +} +# local filesystems +grep ext2 /proc/filesystems >/dev/null 2>&1 +if [ $? -eq 0 ];then + grep ext2 /etc/fstab >/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 ext3 /etc/fstab >/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 ext4 /etc/fstab >/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 xfs /etc/fstab >/dev/null 2>&1 + if [ $? -eq 0 ];then + mount -a -t xfs + fi +fi + +# mount net filesystems (nfs/cifs) +grep nfs /proc/filesystems >/dev/null 2>&1 +if [ $? -eq 0 ];then + grep nfs /etc/fstab >/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 cifs /etc/fstab >/dev/null 2>&1 + if [ $? -eq 0 ];then + mount -a -t cifs + fi +fi +exit 0 diff --git a/package/base-files/src/etc/inittab b/package/base-files/src/etc/inittab index eb00b00ef..f6183798e 100644 --- a/package/base-files/src/etc/inittab +++ b/package/base-files/src/etc/inittab @@ -1,7 +1,9 @@ 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 +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 -- cgit v1.2.3