forked from Shells-com/linux-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-iso.sh
More file actions
executable file
·35 lines (28 loc) · 805 Bytes
/
test-iso.sh
File metadata and controls
executable file
·35 lines (28 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
set -e
. scripts/base.sh
. scripts/getfile.sh
. scripts/qemu.sh
# run a given .qcow2 image in qemu using a configuration similar to shells
# need to take image in first arg. Let's create a 8GB image out of it.
if [ x"$1" = x ]; then
echo "Usage: $0 file.iso"
echo "Will start a qemu instance using this file. The qcow2 file will not be modified"
exit 1
fi
if [ ! -f "$1" ]; then
echo "Usage: $0 file.iso"
echo "File $1 was not found"
exit 1
fi
ISO="$(realpath $1)"
DISK="${ISO%.iso}_disk.qcow2"
if [ ! -f "$DISK" ]; then
echo "Creating new $DISK image"
"$QEMUIMG" create -f qcow2 "$DISK" 8G
fi
# launch qemu
doqemu "$DISK" \
-drive id=cdrom0,if=none,format=raw,readonly=on,file="$ISO" \
-device virtio-scsi-pci,id=scsi0 \
-device scsi-cd,bus=scsi0.0,drive=cdrom0,bootindex=2