forked from roots/phyllomeos
		
	add new post-install scripts
This commit is contained in:
		
							
								
								
									
										38
									
								
								post-first-startup-scripts/create-generic-vm-virtio-spice.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								post-first-startup-scripts/create-generic-vm-virtio-spice.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # This script has be run as root. | ||||
|  | ||||
| # Create and run a diskless virtual machine with `virt-install`. Spice and OpenGL are enabled. | ||||
| # GPU agnostic configuration. Does expect an EFI-based Linux guest.  | ||||
| # The netboot.xyz ISO is attached to this virtual machine, allowing the user to pick an operating system to be installed. | ||||
|  | ||||
| virt-install \ | ||||
|     --connect qemu:///system \ | ||||
|     --metadata description="Spice with OpenGL. Requires an EFI-based guest, ideally with support for virtio-gpu, such as Fedora Workstation." \ | ||||
|     --os-variant detect=off \ | ||||
|     --virt-type kvm \ | ||||
|     --arch x86_64 \ | ||||
|     --machine q35 \ | ||||
|     --name generic \ | ||||
|     --boot uefi \ | ||||
|     --cpu host-model,topology.sockets=1,topology.cores=1,topology.threads=1 \ | ||||
|     --vcpus 1 \ | ||||
|     --memory 2048 \ | ||||
|     --video virtio \ | ||||
|     --graphics spice,gl.enable=yes,listen=none \ | ||||
|     --channel spicevmc \ | ||||
|     --channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \ | ||||
|     --autoconsole none \ | ||||
|     --console pty,target.type=virtio \ | ||||
|     --sound none \ | ||||
|     --network type=default,model=virtio \ | ||||
|     --controller type=virtio-serial \ | ||||
|     --controller type=usb,model=none \ | ||||
|     --controller type=scsi,model=virtio-scsi \ | ||||
|     --input type=keyboard,bus=virtio \ | ||||
|     --input type=tablet,bus=virtio \ | ||||
|     --cdrom /var/lib/libvirt/iso/netboot.xyz.iso \ | ||||
|     --memballoon none \ | ||||
|     --rng /dev/urandom,model=virtio \ | ||||
|     --disk none \ | ||||
|     --install no_install=yes | ||||
| @@ -1,10 +1,11 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # This script can be run as a root user. | ||||
| # Attention please: will soon be deprecated in favor of a more generic VM model  | ||||
|  | ||||
| # Create then shutdown a diskless virtual machine with qemu-system, without any emulated display, using virt-install. | ||||
| # It is designed for vfio-pci (pci-passthrough) in mind, and will work any guest systems that has drivers for the passthroughed GPU as well as paravirtualized drivers (Windows, or Linux).  | ||||
| # The ISO that contains paravirtualized drivers for Windows is attached to this virtual machine. The user has to manually add the Windows ISO. | ||||
| # This script has be run as root. | ||||
|  | ||||
| # Create and run a diskless virtual machine with `virt-install`, without any display. | ||||
| # For Windows, the user has to manually add the Windows ISO as well as the ISO that contains paravirtualized drivers for Windows.  | ||||
|  | ||||
| virt-install \ | ||||
|     --connect qemu:///system \ | ||||
| @@ -13,7 +14,7 @@ virt-install \ | ||||
|     --virt-type kvm \ | ||||
|     --arch x86_64 \ | ||||
|     --machine q35 \ | ||||
|     --name system-windows-vfio-pci \ | ||||
|     --name vfio-pci \ | ||||
|     --boot uefi \ | ||||
|     --cpu host-model,topology.sockets=1,topology.cores=1,topology.threads=1 \ | ||||
|     --vcpus 1 \ | ||||
| @@ -31,8 +32,5 @@ virt-install \ | ||||
|     --input type=keyboard,bus=virtio \ | ||||
|     --input type=tablet,bus=virtio \ | ||||
|     --rng /dev/urandom,model=virtio \ | ||||
|     --cdrom /usr/share/virtio-win/virtio-win-0.1.171.iso \ | ||||
|     --disk none \ | ||||
|     --install no_install=yes | ||||
|  | ||||
| virsh destroy system-windows-vfio-pci | ||||
|     --install no_install=yes | ||||
| @@ -1,5 +1,7 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # Attention please: will soon be deprecated in favor of a more generic VM model  | ||||
|  | ||||
| # This script can be run as a normal user. | ||||
| # Make sure qemu-session is available as an URI in virt-manager running the following in your terminal:  | ||||
| # gsettings set org.virt-manager.virt-manager.connections uris "['qemu:///system', 'qemu:///session']" | ||||
| @@ -113,9 +115,9 @@ virt-install \ | ||||
|  | ||||
| virsh destroy user-linux-egl-headless-gl | ||||
|  | ||||
| # Create then shutdown a diskless virtual machine with qemu-sesssion, SDL and OpenGL enabled, using virt-install. | ||||
| # Create and run a diskless virtual machine with `virt-install`. Spice and OpenGL are enabled. | ||||
| # Should work with all GPUs on the host including Nvidia's and does expect an EFI-based Linux guest.  | ||||
| # No ISO is attached to this virtual machine. The user have to manually add one. | ||||
| # No ISO is attached to this virtual machine. The user has to manually add one. | ||||
|  | ||||
| virt-install \ | ||||
|     --connect qemu:///session \ | ||||
|   | ||||
| @@ -0,0 +1,35 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # Deploy a virtual machine with `virt-install` and automatically install a minimal shell environment on a 5G disk. | ||||
| # GPU and CPU agnostic configuration.  | ||||
|  | ||||
| virt-install \ | ||||
|     --connect qemu:///system \ | ||||
|     --metadata description="Spice with OpenGL. OS shipping with a minimal server environment. Based on Fedora Server 35" \ | ||||
|     --os-variant detect=off \ | ||||
|     --virt-type kvm \ | ||||
|     --arch x86_64 \ | ||||
|     --machine q35 \ | ||||
|     --name minimal-workstation \ | ||||
|     --boot uefi \ | ||||
|     --cpu host-model,topology.sockets=1,topology.cores=1,topology.threads=1 \ | ||||
|     --vcpus 1 \ | ||||
|     --memory 2048 \ | ||||
|     --video virtio \ | ||||
|     --graphics spice,gl.enable=yes,listen=none \ | ||||
|     --channel spicevmc \ | ||||
|     --channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \ | ||||
|     --autoconsole none \ | ||||
|     --console pty,target.type=virtio \ | ||||
|     --sound none \ | ||||
|     --network type=default,model=virtio \ | ||||
|     --controller type=virtio-serial \ | ||||
|     --controller type=usb,model=none \ | ||||
|     --controller type=scsi,model=virtio-scsi \ | ||||
|     --input type=keyboard,bus=virtio \ | ||||
|     --input type=tablet,bus=virtio \ | ||||
|     --memballoon none \ | ||||
|     --rng /dev/urandom,model=virtio \ | ||||
|     --disk path=/var/lib/libvirt/images/virtual-desktop.img,format=raw,bus=virtio,cache=writeback,size=5 \ | ||||
|     --location=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/ \ | ||||
|     --extra-args="inst.ks=https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/dishes/virtual-server.cfg" | ||||
| @@ -0,0 +1,35 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # Deploy a virtual machine with `virt-install` and automatically install a minimal GNOME Shell desktop environment on a 10G disk. | ||||
| # GPU and CPU agnostic configuration.  | ||||
|  | ||||
| virt-install \ | ||||
|     --connect qemu:///system \ | ||||
|     --metadata description="Spice with OpenGL. OS shipping with a minimal GNOME Shell environment. Based on Fedora Server 35" \ | ||||
|     --os-variant detect=off \ | ||||
|     --virt-type kvm \ | ||||
|     --arch x86_64 \ | ||||
|     --machine q35 \ | ||||
|     --name minimal-workstation \ | ||||
|     --boot uefi \ | ||||
|     --cpu host-passthrough,topology.sockets=1,topology.cores=1,topology.threads=1 \ | ||||
|     --vcpus 1 \ | ||||
|     --memory 2048 \ | ||||
|     --video virtio \ | ||||
|     --graphics spice,gl.enable=yes,listen=none \ | ||||
|     --channel spicevmc \ | ||||
|     --channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \ | ||||
|     --autoconsole none \ | ||||
|     --console pty,target.type=virtio \ | ||||
|     --sound none \ | ||||
|     --network type=default,model=virtio \ | ||||
|     --controller type=virtio-serial \ | ||||
|     --controller type=usb,model=none \ | ||||
|     --controller type=scsi,model=virtio-scsi \ | ||||
|     --input type=keyboard,bus=virtio \ | ||||
|     --input type=tablet,bus=virtio \ | ||||
|     --memballoon none \ | ||||
|     --rng /dev/urandom,model=virtio \ | ||||
|     --disk path=/var/lib/libvirt/images/virtual-desktop.img,format=raw,bus=virtio,cache=writeback,size=10 \ | ||||
|     --location=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/ \ | ||||
|     --extra-args="inst.ks=https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/dishes/virtual-desktop.cfg" | ||||
| @@ -0,0 +1,35 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # Deploy Phyllome OS Desktop generic edition  with `virt-install` on a 20G disk, with 4vCPU, 8G of RAM. | ||||
| # GPU and CPU agnostic configuration.  | ||||
|  | ||||
| virt-install \ | ||||
|     --connect qemu:///system \ | ||||
|     --metadata description="Spice with OpenGL. Phyllome OS Desktop edition." \ | ||||
|     --os-variant detect=off \ | ||||
|     --virt-type kvm \ | ||||
|     --arch x86_64 \ | ||||
|     --machine q35 \ | ||||
|     --name virtual-phyllome-os \ | ||||
|     --boot uefi \ | ||||
|     --cpu host-model,topology.sockets=1,topology.cores=2,topology.threads=2 \ | ||||
|     --vcpus 1 \ | ||||
|     --memory 8192 \ | ||||
|     --video virtio \ | ||||
|     --graphics spice,gl.enable=yes,listen=none \ | ||||
|     --channel spicevmc \ | ||||
|     --channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \ | ||||
|     --autoconsole none \ | ||||
|     --console pty,target.type=virtio \ | ||||
|     --sound none \ | ||||
|     --network type=default,model=virtio \ | ||||
|     --controller type=virtio-serial \ | ||||
|     --controller type=usb,model=none \ | ||||
|     --controller type=scsi,model=virtio-scsi \ | ||||
|     --input type=keyboard,bus=virtio \ | ||||
|     --input type=tablet,bus=virtio \ | ||||
|     --memballoon none \ | ||||
|     --rng /dev/urandom,model=virtio \ | ||||
|     --disk path=/var/lib/libvirt/images/virtual-desktop.img,format=raw,bus=virtio,cache=writeback,size=20 \ | ||||
|     --location=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Everything/x86_64/os/ \ | ||||
|     --extra-args="inst.ks=https://raw.githubusercontent.com/PhyllomeOS/phyllomeos/main/dishes/virtual-phyllome-desktop.cfg" | ||||
| @@ -1,6 +1,6 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| # usermod -a -G libvirt $(whoami) # add current user to the libvirt group | ||||
| # usermod -a -G libvirt kvm $(whoami) # add current user to the libvirt and kvm groups | ||||
|  | ||||
| # virsh commands fail in a kickstart environment (chroot or not it seems). would need to fetch a script and execute post-launch with a delay, for example using a systemd unit  | ||||
| virsh pool-define-as iso dir - - - - /var/lib/libvirt/iso/ # Make libvirt aware of this new directory by creating a so-called 'pool'. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user