Desktop scripts

This commit is contained in:
Sonny 2017-06-17 18:35:23 +02:00
parent 6079f98037
commit 639e4dbf2d
19 changed files with 321 additions and 0 deletions

11
scripts/qemu/debian-unstable Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
qemu-system-x86_64 -enable-kvm --daemonize \
-cpu host \
-drive format=raw,file="/media/platvoeten/VM/debian-unstable.img",if=virtio \
-m 4G \
-name "debian-unstable" \
-vga qxl \
-spice port="5922",disable-ticketing \
-device virtio-serial \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0

12
scripts/qemu/kubuntu-1704 Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
qemu-system-x86_64 -enable-kvm --daemonize \
-cpu host \
-drive format=raw,file="/media/platvoeten/VM/ubuntu-1704.img",if=virtio \
-m 4G \
-name "kubuntu-1704" \
-vga qxl \
-spice port="5930",disable-ticketing \
-device virtio-serial \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 &&
exec spicy --title "kubuntu-1704" 127.0.0.1 -p "5930"

94
scripts/qemu/qemu-helper Executable file
View file

@ -0,0 +1,94 @@
#!/bin/bash
## Script to create and or edit a qemu script
function create_script {
echo -n "Create VM image? [y/n]: "
read IMAGE
## Optional image creation
if [ "$IMAGE" == "y" ] ;then
echo -n "Enter the the path of the image: "
read IMAGE_NAME
DISK=$IMAGE_NAME
echo -n "Enter the size of the image [10G/5G]: "
read SIZE
qemu-img create -f raw "$IMAGE_NAME" "$SIZE"
elif [ -z "$IMAGE" ] ;then
echo -n "Enter the Disk path and press [ENTER]: "
read DISK
fi
echo -n "Boot disk needed? [y/n]: "
read ANSWER
if [ "$ANSWER" == "y" ] ;then
echo -n "Enter the Boot disk path and press [ENTER]: "
read BOOT_DISK
else
echo "Okay, dropping boot disk"
fi
echo -n "Enter the VM name and press [ENTER]: "
read NAME
echo -n "Enter the port number and press [ENTER]: "
read PORT
echo -n "Enter qemu script's name and press [ENTER]: "
read FILE
# Creation of script
touch "$HOME/.bin/qemu/$FILE"
chmod +x "$HOME/.bin/qemu/$FILE"
if [ "$ANSWER" == "y" ] ;then
cat <<EOF > "$HOME/.bin/qemu/$FILE"
#!/bin/bash
qemu-system-x86_64 -enable-kvm --daemonize '\'
-cpu host '\'
-drive format=raw,file="$DISK",if=virtio '\'
-boot d -cdrom "$BOOT_DISK" '\'
-m 4G '\'
-name "$NAME" '\'
-vga qxl '\'
-spice port="$PORT",disable-ticketing '\'
-device virtio-serial '\'
-chardev spicevmc,id=vdagent,name=vdagent '\'
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 &&
exec spicy --title "$NAME" 127.0.0.1 -p "$PORT"
EOF
elif [ "$ANSWER" == "n" ] ;then
cat <<EOF > "$HOME/.bin/qemu/$FILE"
#!/bin/bash
qemu-system-x86_64 -enable-kvm --daemonize '\'
-cpu host '\'
-drive format=raw,file="$DISK",if=virtio '\'
-m 4G '\'
-name "$NAME" '\'
-vga qxl '\'
-spice port="$PORT",disable-ticketing '\'
-device virtio-serial '\'
-chardev spicevmc,id=vdagent,name=vdagent '\'
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 &&
exec spicy --title "$NAME" 127.0.0.1 -p "$PORT"
EOF
fi
# Fix
## Remove '' from \
sed -i "s/'//g" "$HOME/.bin/qemu/$FILE"
}
## Remove GUI options for headless VM
function remove_gui {
sed -i "/-vga\|-spice\|virtio-serial\|-chardev\|exec/d" "$HOME/.bin/qemu/$1"
}
echo -n "Do you want to create a qemu script or remove the gui from a script? [create/remove]: "
read FUNCTION
if [ "$FUNCTION" == "create" ] ;then
create_script
elif [ "$FUNCTION" == "remove" ] ;then
echo "Enter script's file path and press [Enter]: "
read FILENAME
remove_gui $FILENAME
fi

14
scripts/qemu/raspbian Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
# Qemu script to start raspbian
qemu-system-arm \
-kernel /media/platvoeten/Downloads/kernel-qemu-4.4.34-jessie \
-cpu arm1176 \
-net user,hostfwd=tcp::2222-:22 \
-net nic \
-display none \
-m 256 \
-no-reboot \
-M versatilepb \
-serial stdio\
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-drive "file=/media/platvoeten/VM/raspbian.img,index=0,media=disk,format=raw"

12
scripts/qemu/ubuntu-desktop Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
qemu-system-x86_64 -enable-kvm --daemonize \
-cpu host \
-drive format=raw,file="/media/platvoeten/VM/ubuntu/ubuntu-desktop.img",if=virtio \
-name "ubuntu-desktop" \
-vga qxl \
-redir tcp:5560::22 \
-m 3G \
-spice port="5929",disable-ticketing \
-device virtio-serial \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0

12
scripts/qemu/ubuntu-server Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
qemu-system-x86_64 -enable-kvm --daemonize \
-cpu host \
-drive format=raw,file="/media/platvoeten/VM/ubuntu/ubuntu-server.img",if=virtio \
-netdev user,id=vmnic,hostfwd=tcp::5555-:22,hostfwd=tcp::5556-:8000,hostname=ubuntu-server -device virtio-net,netdev=vmnic \
-m 1G \
-name "ubuntu-server" \
-vga qxl \
-spice port="5927",disable-ticketing \
-device virtio-serial \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0

9
scripts/qemu/ubuntu-server.old Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
qemu-system-x86_64 -enable-kvm \
-cpu host \
-drive format=raw,file="/media/platvoeten/VM/ubuntu/ubuntu-server.img",if=virtio \
-drive format=raw,file="/media/platvoeten/VM/test-hdd.img",if=virtio \
-netdev user,id=vmnic,smb=/home/platvoeten,hostfwd=tcp::5555-:22,hostfwd=tcp::5556-:8000,hostname=ubuntu-server -device virtio-net,netdev=vmnic \
-display none \
-m 1G \
-name "ubuntu-server" \

View file

@ -0,0 +1 @@
OPTIONS="-enable-kvm --daemonize -cpu host -drive format=raw,file=/media/platvoeten/VM/ubuntu-server.img,if=virtio -netdev user,id=vmnic,hostname=ubuntu-server -device virtio-net,netdev=vmnic -redir tcp:5555::22 -m 4G -spice port=5925,disable-ticketing -device virtio-serial -chardev spicevmc,id=vdagent,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0"

View file

@ -0,0 +1 @@
OPTIONS="-enable-kvm --daemonize -cpu host -boot d -cdrom /media/platvoeten/Downloads/Windows_iso/Win10_English_x64.iso -drive file=/media/platvoeten/Downloads/virtio-win-0.1.126.iso,index=3,media=cdrom -drive format=raw,file=/media/platvoeten/VM/Windows.img,if=virtio -net nic -net user,hostname=Windows10,smb=/home/platvoeten/Sync/Inholland -m 3G -name Windows-10 -spice port=5928,disable-ticketing -device virtio-serial -chardev spicevmc,id=vdagent,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0"

14
scripts/qemu/windows10 Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
## Windows 10 Virtio VM
qemu-system-x86_64 -enable-kvm \
-cpu host \
-drive file=/media/platvoeten/Downloads/virtio-win-0.1.126.iso,index=3,media=cdrom \
-cdrom /dev/cdrom \
-drive format=raw,file=/media/platvoeten/VM/windows10.img,if=virtio \
-netdev user,id=vmnic,smb=/home/platvoeten/Sync/Inholland,hostname=windows10 -device virtio-net,netdev=vmnic \
-m 4G \
-name "Windows 10" \
-spice port=5928,disable-ticketing \
-device virtio-serial \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0