OSDN Git Service

init: try to mount according to filesystem type
authorChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 15 Jan 2018 08:06:24 +0000 (16:06 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 15 Jan 2018 08:06:24 +0000 (16:06 +0800)
initrd/init

index fdcea52..4916241 100755 (executable)
@@ -3,7 +3,7 @@
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
 # and Thorsten Glaser <tg@mirbsd.org>
 #
-# Last updated 2017/10/06
+# Last updated 2018/01/12
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
@@ -64,8 +64,17 @@ try_mount()
                # for NFS roots, use nolock to avoid dependency to portmapper
                RW="nolock,$RW"
        fi
-       # FIXME: any way to mount ntfs gracefully?
-       mount -o $RW,noatime $@ || mount.ntfs-3g -o rw,force $@
+       case $(blkid $1) in
+               *TYPE=*ntfs*)
+                       mount.ntfs-3g -o rw,force $@
+                       ;;
+               *TYPE=*)
+                       mount -o $RW,noatime $@
+                       ;;
+               *)
+                       return 1
+                       ;;
+       esac
 }
 
 check_root()
@@ -75,7 +84,6 @@ check_root()
                blk=`basename $1`
                [ ! -e /dev/block/$blk ] && ln $1 /dev/block
                dev=/dev/block/$blk
-               blkid $dev | grep -q TYPE || return 1
        else
                dev=$1
        fi