From: Martin Lucina Date: Sun, 23 Nov 2014 21:02:12 +0000 (+0100) Subject: rumprun: Use blkid rather than file to detect fstype X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a2fc4f9dbc9851cbb97ced7b8eec313d07a19ab0;p=rumpuser-xen.git rumprun: Use blkid rather than file to detect fstype 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 --- diff --git a/app-tools/rumprun b/app-tools/rumprun index a0e02b3..b15b4d0 100755 --- a/app-tools/rumprun +++ b/app-tools/rumprun @@ -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()