diff options
Diffstat (limited to 'src/qemu.sh')
-rwxr-xr-x | src/qemu.sh | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/qemu.sh b/src/qemu.sh index 130b688..81ffa1f 100755 --- a/src/qemu.sh +++ b/src/qemu.sh | |||
@@ -73,8 +73,19 @@ case $(arch) in | |||
73 | *) qemu=qemu-system-i386 ;; | 73 | *) qemu=qemu-system-i386 ;; |
74 | esac | 74 | esac |
75 | 75 | ||
76 | try_fallocate() | ||
77 | { | ||
78 | for size in "$@"; do | ||
79 | fallocate -l "$size" "$disk"~tmp || continue | ||
80 | mv "$disk"~tmp "$disk" | ||
81 | return | ||
82 | done | ||
83 | false | ||
84 | } | ||
85 | |||
76 | if [ ! -e "$disk" ]; then | 86 | if [ ! -e "$disk" ]; then |
77 | fallocate -l 10GB "$disk" | 87 | try_fallocate 16GB 8GB 4GB 2GB 1GB || |
88 | echo "Warning: no virtual disk (could not create $disk)" >&2 | ||
78 | fi | 89 | fi |
79 | 90 | ||
80 | if grep -q '^flags.*\<vmx\>' /proc/cpuinfo; then | 91 | if grep -q '^flags.*\<vmx\>' /proc/cpuinfo; then |