forked from Shells-com/linux-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-linux.sh
More file actions
executable file
·36 lines (28 loc) · 851 Bytes
/
test-linux.sh
File metadata and controls
executable file
·36 lines (28 loc) · 851 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
35
#!/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 160GB image out of it.
if [ x"$1" = x ]; then
echo "Usage: $0 file.qcow2 [kernel commandline options]"
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.qcow2 [kernel commandline options]"
echo "File $1 was not found"
exit 1
fi
IMGFILE="$(realpath $1)"
OVERLAY="${IMGFILE%.qcow2}_test.qcow2"
if [ x"$OVERLAY" = x"$IMGFILE" ]; then
OVERLAY="${OVERLAY}_test.qcow2"
fi
if [ ! -f "$OVERLAY" ]; then
echo "Creating new $OVERLAY overlay"
"$QEMUIMG" create -f qcow2 -b "$IMGFILE" -F qcow2 "$OVERLAY" 160G
fi
# launch qemu
qemukernel "$OVERLAY" "$2"