You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
675 B
17 lines
675 B
#!/bin/bash |
|
# Check which virtualization technology to use |
|
# We prefer kvm, kqemu, userspace in that order. |
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin |
|
|
|
[[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS="" |
|
$(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu " |
|
[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS="" |
|
[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS="" |
|
[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS="" |
|
|
|
[[ $BIN ]] || { |
|
echo "Could not find a working KVM or QEMU to test with!" >&2 |
|
echo "Please install kvm or qemu." >&2 |
|
exit 1 |
|
} |
|
exec sudo $BIN $ARGS "$@"
|
|
|