dmsquash-live: add dmsquash-generator
[dracut.git] / test / run-qemu
bloba65ea198821c2b3f5eaeea5ababac33ccacd18b0
1 #!/bin/bash
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=""
12 [[ $BIN ]] || {
13 echo "Could not find a working KVM or QEMU to test with!" >&2
14 echo "Please install kvm or qemu." >&2
15 exit 1
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"
27 else
28 VMLINUZ="/boot/vmlinuz-${KVERSION}"
32 exec sudo $BIN $ARGS -kernel $VMLINUZ "$@"