diff options
-rw-r--r-- | package/base-files/src/etc/init.d/fs | 39 | ||||
-rw-r--r-- | package/base-files/src/etc/mdev.conf | 2 | ||||
-rwxr-xr-x | package/base-files/src/etc/mdev/fs | 2 |
3 files changed, 21 insertions, 22 deletions
diff --git a/package/base-files/src/etc/init.d/fs b/package/base-files/src/etc/init.d/fs index 29d72168c..8bde402ec 100644 --- a/package/base-files/src/etc/init.d/fs +++ b/package/base-files/src/etc/init.d/fs @@ -8,26 +8,25 @@ # activate any logical volumes [ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay; } -fstypes="ext2 ext3 ext4 xfs vfat ntfs" +rootdisk=$(readlink /dev/root) +# strip partitions (f.e. mmcblk0p2, sda2, ..) +rootdisk=${rootdisk%p*} +rootdisk=${rootdisk%[1-9]} +rootparts=$(grep "^/dev/${rootdisk}" /etc/fstab|awk '{ print $1 }') -# filesystem checks -for fs in $fstypes; do - [ -x /usr/sbin/fsck.$fs ] && { - for i in $(grep -v "^#" /etc/fstab|grep $fs|awk '{ print $1}');do - echo "Checking filesystem on $i with $fs" - fsck -p -t $fs $i - done - } -done - -# mount local filesystems -for fs in $fstypes; do - grep $fs /proc/filesystems >/dev/null 2>&1 - if [ $? -eq 0 ];then - grep -v "^#" /etc/fstab |grep $fs >/dev/null 2>&1 - if [ $? -eq 0 ];then - mount -a -t $fs - fi - fi +for part in $rootparts; do + fstype=$(grep "^$part" /etc/fstab|awk '{ print $3 }') + mnt=$(grep "^$part" /etc/fstab|awk '{ print $2 }') + [ -x /usr/sbin/fsck.$fstype ] && { + logger -t fs -s "Checking $fstype filesystem on $part" + fsck -p -t $fstype $part + } + grep $fstype /proc/filesystems >/dev/null 2>&1 + if [ $? -eq 0 ];then + mount $mnt + else + logger -t fs -s "Filesystem $fstype not in kernel" + exit 1 + fi done exit 0 diff --git a/package/base-files/src/etc/mdev.conf b/package/base-files/src/etc/mdev.conf index 804a87d06..414e63ba1 100644 --- a/package/base-files/src/etc/mdev.conf +++ b/package/base-files/src/etc/mdev.conf @@ -15,4 +15,4 @@ snd/controlC0 root:audio 660 snd/pcmC0D0c root:audio 660 snd/pcmC0D0p root:audio 660 msr0 root:root 660 @(mkdir -p /dev/cpu/0 && ln -sf /dev/msr0 /dev/cpu/0/msr) -sd[a-z][1-9] root:root 660 */etc/mdev/fs +sd[a-z][1-9]* root:root 660 */etc/mdev/fs diff --git a/package/base-files/src/etc/mdev/fs b/package/base-files/src/etc/mdev/fs index 4f360216a..e56115b79 100755 --- a/package/base-files/src/etc/mdev/fs +++ b/package/base-files/src/etc/mdev/fs @@ -18,7 +18,7 @@ adk_check() { # filesystem check adk_fsck() { [ -x /usr/sbin/fsck.$fs ] && { - logger -t fs -s "Checking filesystem on ${MDEV} with $fs" + logger -t fs -s "Checking $fs filesystem on ${MDEV}" fsck -p -t $fs ${MDEV} } } |