-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-vm.sh
executable file
·34 lines (29 loc) · 1.01 KB
/
run-vm.sh
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
SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $SRC_DIR/config.sh
##############################################################################
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTPS_PROXY
export ftp_proxy=$FTP_PROXY
QEMU_BIN=qemu-system-x86_64
VNC_PORT=5
SSH_PORT=10022
##############################################################################
run_ok=false
if hash $QEMU_BIN 2>/dev/null; then
run_ok=true
fi
if [ -e $QEMU_BIN ]; then
run_ok=true
fi
if [ ! -e $QEMU_IMG_NAME ]; then
run_ok=false
fi
if [ "$run_ok" = false ]; then
echo "ERR: Qemu image/binary is missing."
exit 1
fi
echo "**Login to VM with ssh 'sugesh@localhost -p $SSH_PORT'**"
echo "***************************************************************"
echo "**Login to VM with vnc vnc 'vncviewer localhost:$VNC_PORT'**"
$QEMU_BIN -cpu host -enable-kvm -m 8G -smp cores=6 -hda $QEMU_IMG_NAME -net user,net=20.0.0.0/24,host=20.0.0.1,hostfwd=tcp:127.0.0.1:$SSH_PORT-:22 -net nic -vnc :$VNC_PORT -nographic