dots/.bin/qvirt

42 lines
857 B
Bash
Executable File

#!/bin/bash
# qemu-img create -f qcow2 ctlos.qcow2 14G
# -net nic -net user,hostfwd=tcp::22222-:22 \
# sudo systemctl start sshd
# ssh -p 22222 liveuser@localhost
# -net nic -net user \
# -vnc :1 \
QVIRT_DIR=$HOME/.qvirt
QVIRT_QCOW=arch.qcow2
QVIRT_SIZE=10G
# create dir & drive
if [ ! -d $QVIRT_DIR ]; then
mkdir -p $QVIRT_DIR
qemu-img create -f qcow2 $QVIRT_DIR/$QVIRT_QCOW $QVIRT_SIZE
fi
if [ "$1" = "-i" ]; then
# qvirt -i
qemu-system-x86_64 \
-enable-kvm \
-m 2048M \
-net nic,model=virtio -net user,hostfwd=tcp::22222-:22 \
-vga qxl \
-device AC97 \
-drive file=$QVIRT_DIR/$QVIRT_QCOW,if=virtio \
-cdrom $2 \
-boot d
else
# qvirt
qemu-system-x86_64 \
-enable-kvm \
-m 2048M \
-net nic,model=virtio-net-pci -net user,hostfwd=tcp::22222-:22 \
-vga qxl \
-device AC97 \
-hda $1
fi