mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-10 13:57:22 +03:00
bug #1042: use stat when the image is not a dir
This commit is contained in:
parent
b891561d96
commit
9b9aed19f9
@ -64,9 +64,15 @@ echo "$IMAGE_REPOSITORY_PATH/`echo $CANONICAL_MD5 | cut -d ' ' -f1`"
|
||||
}
|
||||
|
||||
function fs_du {
|
||||
SIZE=`du -sk "$1" | cut -f1`
|
||||
if [ -d "$1" ]; then
|
||||
SIZE=`du -s "$1" | cut -f1`
|
||||
error=$?
|
||||
else
|
||||
SIZE=`stat -c %s "$1"`
|
||||
error=$?
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $error -ne 0 ]; then
|
||||
SIZE=0
|
||||
else
|
||||
SIZE=$(($SIZE/1024))
|
||||
|
Loading…
x
Reference in New Issue
Block a user