Update install.sh
This commit is contained in:
parent
5c5a9eabbe
commit
24f3f4595d
1 changed files with 7 additions and 5 deletions
|
@ -58,7 +58,7 @@ downloadFile() {
|
|||
local url="$1"
|
||||
local base="$2"
|
||||
local name="$3"
|
||||
local msg rc total total_mb progress name
|
||||
local msg rc total size progress
|
||||
|
||||
local dest="$STORAGE/$base.tmp"
|
||||
rm -f "$dest"
|
||||
|
@ -88,9 +88,9 @@ downloadFile() {
|
|||
|
||||
if (( rc == 0 )) && [ -f "$dest" ]; then
|
||||
total=$(stat -c%s "$dest")
|
||||
total_gb=$(formatBytes "$total")
|
||||
size=$(formatBytes "$total")
|
||||
if [ "$total" -lt 100000 ]; then
|
||||
error "Invalid image file: is only $total_gb ?" && return 1
|
||||
error "Invalid image file: is only $size ?" && return 1
|
||||
fi
|
||||
html "Download finished successfully..."
|
||||
mv -f "$dest" "$STORAGE/$base"
|
||||
|
@ -173,8 +173,10 @@ convertImage() {
|
|||
# Work around qemu-img bug
|
||||
cur_size=$(stat -c%s "$tmp_file")
|
||||
cur_gb=$(formatBytes "$cur_size")
|
||||
if ! fallocate -l "$cur_size" "$tmp_file"; then
|
||||
error "Failed to allocate $cur_gb for image!"
|
||||
if ! fallocate -l "$cur_size" "$tmp_file" &>/dev/null; then
|
||||
if ! fallocate -l -x "$cur_size" "$tmp_file"; then
|
||||
error "Failed to allocate $cur_gb for image!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue