sh arithmetic overflows, use bc to calculate image size

This commit is contained in:
erdgeist 2006-05-15 19:37:03 +00:00
parent 098c7cbf69
commit 783782f203

View File

@ -189,7 +189,7 @@ create)
# check for a sane image size and split it up in blocks
if [ "${ezjail_imagesize}" ]; then
_val=`echo "${ezjail_imagesize}"|tr A-Z a-z|sed -Ees:g:km:g -es:m:kk:g -es:k:*2b:g -es:b:*128w:g -es:w:*4\ :g -e"s:(^|[^0-9])0x:\1\0X:g" -ey:x:*:`
_val=`echo $(( ${_val} ))`
_val=`echo ${_val} | bc`
[ $? -eq 0 -a ${_val} -gt 0 ] || exerr "Error: The image size you specified is somehow incomprehensible (you specified ${ezjail_imagesize})."
ezjail_imageblockcount=$(( ${_val} / 1048576 ))
ezjail_imagerestbytes=$(( ${_val} % 1048576 ))