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
18 KVERSION
=${KVERSION-$(uname -r)}
20 VMLINUZ
="/lib/modules/${KVERSION}/vmlinuz"
22 if ! [ -f "$VMLINUZ" ]; then
23 [[ -f /etc
/machine-id
]] && read MACHINE_ID
< /etc
/machine-id
25 if [[ $MACHINE_ID ]] && ( [[ -d /boot
/${MACHINE_ID} ]] ||
[[ -L /boot
/${MACHINE_ID} ]] ); then
26 VMLINUZ
="/boot/${MACHINE_ID}/$KVERSION/linux"
28 VMLINUZ
="/boot/vmlinuz-${KVERSION}"
32 exec sudo
$BIN $ARGS -kernel $VMLINUZ "$@"