#!/bin/sh # Slackware Stable VM # What are my images? BASE="slackware_142_base.img" WIP="slackware_142_wip.img" TREE="/HD_images/vms" # host specific settings CPUS="-cpu host -smp 4" RAM="-m 4G" #i7-5820K 32GB DDR4 RAM set -e # go to image directory cd $TREE # Is the NFS share mounted on the host? Note: specified in fstab so users can mount #if [ ! "mountpoint -q /archive" ]; then # mount /archive #fi y="" x="" until [ "$x" = "exit" -o "$y" = "exit" ]; do if [ "$1" = "" ]; then x="$(zenity --list --radiolist --width=375 --height=300 \ --title="Slackware Qemu" \ --column="" --column="Function" --column="Description" \ false new "Create new BASE image from iso" \ false base "Run BASE image" \ false create "Create new WIP from BASE" \ true wip "Run Work In Progress (WIP) image" \ false classic "Run Slackware 1.01!" \ false help "Help" \ false exit "Exit" 2>/dev/null)" else x=$1 y="exit" fi case "$x" in wip) echo "Launching WIP image." qemu-system-x86_64 -enable-kvm -machine accel=kvm $RAM -hda $WIP -cdrom /dev/sr1 -boot order=cd $CPUS \ -name "Slackware-slable" -soundhw ac97 -vga std -sdl -display gtk -usb -vnc :3 \ -fsdev local,id=data1,path=/archive/,security_model=passthrough -device virtio-9p-pci,fsdev=data1,mount_tag=data \ -fsdev local,id=data2,path=/data/slackware/,security_model=passthrough -device virtio-9p-pci,fsdev=data2,mount_tag=build \ -netdev user,id=mynet1,hostname=phantom,hostfwd=tcp::10022-:22 -device virtio-net-pci,netdev=mynet1,mac=52:54:00:35:a6:50 # ssh -p 10044 @localhost to remote into VM from host # must have /archive folder on host to share files an insert into /etc/fstab # data /archive 9p trans=virtio 0 0 ;; base) echo "Launching BASE image." qemu-system-x86_64 -enable-kvm -machine accel=kvm -$RAM -hda $BASE -cdrom /dev/sr1 -boot order=cd $CPUS \ -name "Slackware-stable" -soundhw ac97 -vga std -sdl \ -fsdev local,id=data1,path=/archive/,security_model=mapped -device virtio-9p-pci,fsdev=data1,mount_tag=data \ -netdev user,id=mynet1,hostname=phantom -device virtio-net-pci,netdev=mynet1,mac=52:54:00:35:a6:50 ;; create) echo "Deleting old copy-on-wite image..." rm -f $WIP echo "...creating new copy-on-write image..." qemu-img create -f qcow2 -b $BASE $WIP echo "...done." ;; new) echo "Creating new BASE image from ISO..." echo "Delete the old files..." rm -f $BASE $WIP echo "Create empty image..." qemu-img create -f qcow2 $BASE 40G echo "Boot ISO..." qemu-system-x86_64 -enable-kvm -machine accel=kvm $RAM $CPUS -hda $BASE -cdrom /HD_images/slackware/slackware-14.2-iso/slackware-14.2-install-dvd.iso \ -boot order=dc -name "Slackware-current" -soundhw ac97 -vga std -sdl echo "...done." ;; classic) echo "Welcome to Slackware 1.01!" qemu-system-x86_64 -enable-kvm -cpu 486 -m 16M \ -drive if=ide,format=qcow2,file=slackware.qcow2 \ -vga std -sdl \ -netdev user,id=slirp,hostname=slackware \ -device ne2k_isa,netdev=slirp \ -serial stdio \ ;; help) echo "Useage: $0 [wip|base|create|new]" echo "wip = run Work In Progress image" echo "classic = Run Slackware 1.01!" echo "base = run BASE image" echo "create = create new WIP from BASE" echo "new = create new BASE image from iso" ;; esac done