summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/init.d/fs
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/src/etc/init.d/fs')
-rw-r--r--package/base-files/src/etc/init.d/fs58
1 files changed, 19 insertions, 39 deletions
diff --git a/package/base-files/src/etc/init.d/fs b/package/base-files/src/etc/init.d/fs
index 8f4397897..e995422ee 100644
--- a/package/base-files/src/etc/init.d/fs
+++ b/package/base-files/src/etc/init.d/fs
@@ -8,46 +8,26 @@
# activate any logical volumes
[ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay; }
+fstypes="ext2 ext3 ext4 xfs"
+
# 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
+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
- mount -a -t xfs
+ grep -v "^#" /etc/fstab |grep $fs >/dev/null 2>&1
+ if [ $? -eq 0 ];then
+ mount -a -t $fs
+ fi
fi
-fi
+done
exit 0