mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
Merge branch 'feature-2589' of git.opennebula.org:one into feature-2589
This commit is contained in:
commit
64c46daac9
@ -154,25 +154,18 @@ function gzip_file_size {
|
||||
function fs_size {
|
||||
|
||||
case $1 in
|
||||
http://*/download|https://*/download)
|
||||
BASE_URL=${1%%/download}
|
||||
HEADERS=`wget -S --spider --no-check-certificate $BASE_URL 2>&1`
|
||||
http://*)
|
||||
HEADERS=`curl -LIk $1 2>&1`
|
||||
|
||||
echo $HEADERS | grep "market" > /dev/null 2>&1
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
#URL is from market place
|
||||
SIZE=`wget -O - -S --no-check-certificate $BASE_URL 2>&1|grep -E "^ *\"size\": \"?[0-9]+\"?.$"|tr -dc 0-9`
|
||||
if echo "$HEADERS" | grep -q "OpenNebula-AppMarket-Size"; then
|
||||
# An AppMarket/Marketplace URL
|
||||
SIZE=$(echo "$HEADERS" | grep "^OpenNebula-AppMarket-Size:" | tail -n1 | cut -d: -f2)
|
||||
else
|
||||
#Not a marketplace URL
|
||||
SIZE=`wget -S --spider --no-check-certificate $1 2>&1 | grep Content-Length | cut -d':' -f2`
|
||||
# Not an AppMarket/Marketplace URL
|
||||
SIZE=$(echo "$HEADERS" | grep "^Content-Length:" | tail -n1 | cut -d: -f2)
|
||||
fi
|
||||
error=$?
|
||||
;;
|
||||
http://*|https://*)
|
||||
SIZE=`wget -S --spider --no-check-certificate $1 2>&1 | grep Content-Length | cut -d':' -f2`
|
||||
error=$?
|
||||
;;
|
||||
*)
|
||||
if [ -d "$1" ]; then
|
||||
SIZE=`du -sb "$1" | cut -f1`
|
||||
|
Loading…
x
Reference in New Issue
Block a user