1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #1770: Handle non-uniform 'file -b' output in distributions

(cherry picked from commit c1ff1fd11b1992601c86c3eedfbb4c7c080a398d)
This commit is contained in:
Jaime Melis 2013-11-25 15:13:56 +01:00 committed by Ruben S. Montero
parent c1d3f62543
commit d6438fb623

View File

@ -178,12 +178,12 @@ function fs_size {
SIZE=`du -sb "$1" | cut -f1`
error=$?
else
TYPE=$(cat "$1" | head -n 1024 | file -b -)
TYPE=$(cat "$1" | head -n 1024 | file -b - | tr A-Z a-z)
case "$TYPE" in
*gzip*)
SIZE=$(gzip_file_size "$1")
;;
*QCOW*)
*qcow*)
SIZE=$($QEMU_IMG info "$1" | sed -n 's/.*(\([0-9]*\) bytes).*/\1/p')
;;
*)