2 # Check which virtualization technology to use
3 # We prefer kvm, kqemu, userspace in that order.
4 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
6 [[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=""
7 $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu "
8 [[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS=""
9 [[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS=""
10 [[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS=""
13 echo "Could not find a working KVM or QEMU to test with!" >&2
14 echo "Please install kvm or qemu." >&2
17 exec sudo $BIN $ARGS "$@"