]> xenbits.xensource.com Git - rumpuser-xen.git/commitdiff
rumprun: Use blkid rather than file to detect fstype
authorMartin Lucina <martin@lucina.net>
Sun, 23 Nov 2014 21:02:12 +0000 (22:02 +0100)
committerMartin Lucina <martin@lucina.net>
Sun, 23 Nov 2014 21:02:12 +0000 (22:02 +0100)
The output of file differs between systems (and Linux distribution
versions!). Use blkid for now to detect block device filesystem type,
will need to be revisited or marked as a dependency on e2fsprogs for
*BSD.

Signed-off-by: Martin Lucina <martin@lucina.net>
app-tools/rumprun

index a0e02b3229603875211f63fec8732b4416a5b6f6..b15b4d0db9a01df76bc6440ab0a2471331416b1f 100755 (executable)
@@ -56,21 +56,26 @@ EOM
 
 # Detect the filesystem type of the image at $1.
 detect_fstype() {
-       ftype=$(file -b $1)
-       case $ftype in
-               "Unix Fast File system"*)
-                       echo ffs
-                       return 0
-                       ;;
-               "ISO 9660"*)
-                       echo cd9660
-                       return 0
-                       ;;
-               *)
-                       echo unknown
-                       return 1
-                       ;;
-       esac
+       (
+               eval $(blkid -o export $1)
+               if [ $? -ne 0 ]; then
+                       TYPE=unknown
+               fi
+               case ${TYPE} in
+                       ufs)
+                               echo ffs
+                               return 0
+                               ;;
+                       iso9660)
+                               echo cd9660
+                               return 0
+                               ;;
+                       *)
+                               echo unknown
+                               return 1
+                               ;;
+               esac
+       )
 }
 
 cidr2mask()