Hello,

here you can find my scripts, which will rebuild all your sys-vms:
All scripts must be made executable with chmod +x FILENAME

1) qvm-destroy.sh
this script  is a helper script which can be used to kill and remove a VM in 
one step
I'd like to see an option in qvm-kill to get this done:
something like: qvm-kill --purge
Until then, this script should work (Warning: it will kill the VM without any 
further questions :-)

#!/bin/bash
# Kill a running AppVM and remove it
# Usage: qvm-destroy <Name-of-VM>
echo "Killing VM: $1"
qvm-kill $1
echo "Removing VM: $1"
qvm-remove $1
echo "Waiting for 5s (just to be sure)"
sleep 5s

2) create-t-fedora-25-minimal.sh
Built a custom template which will be used to create the new sys-vms
mytemplatevm is the name of the new template, which will then be used in step 3 
to build the sys-vms.
I like to work with clones of the default templates, so that I can always go 
back to a standard template.
I name my VMs with t-... to indicate that this VM is a template VM.

#!/bin/bash
# Variables
templatebasevm=fedora-25-minimal
mytemplatevm=t-fedora-25-minimal
# Install templatebasevm (just to make sure it is available)
sudo qubes-dom0-update qubes-template-$templatebasevm
# Remove existing Template VM
echo "Killing VM: $mytemplatevm"
qvm-kill $mytemplatevm
echo "Removing VM: $mytemplatevm"
qvm-remove $mytemplatevm
echo "Waiting for 10s until everything is finished"
sleep 10s
# Create a new template based on default template
echo "Clone $templatebasevm to $mytemplatevm"
qvm-clone $templatebasevm $mytemplatevm
# Hide original template
qvm-prefs -s $templatebasevm internal true
qvm-prefs -s $mytemplatevm internal false
# Launch new template
echo Launch new template-vm $mytemplatevm
qvm-start --tray $mytemplatevm
echo "Wait for 10sec until $mytemplatevm VM is up"
sleep 10s
# Install Updates and additional packages
echo "Install updates and additional applications in $mytemplatevm"
qvm-run $mytemplatevm 'xterm -e "sudo dnf -y update && \
   sudo dnf -y install mc nano pass langpacks-en langpacks-de 
glibc-locale-source qubes-usb-proxy \
                       qubes-input-proxy-sender gnome-terminal terminus-fonts 
less dejavu-sans-fonts \
                       NetworkManager NetworkManager-wifi 
network-manager-applet wireless-tools dbus-x11 \
                       tinyproxy notification-daemon gnome-keyring 
iwl6000g2a-firmware keepass \
                       linux-firmware && \
                       shutdown -h now "'
echo "Wait until all updates have been installed"
read -p "Press Enter to continue"

3) create-my-sysvms.sh
This script will actually build the new sys-vms (and remove the old one before).
It will use the template you have created in step 2)

#!/bin/bash
systemplate=t-fedora-25-minimal
###### Kill and remove existing vms
./qvm-destroy sys-firewall
./qvm-destroy sys-net
./qvm-destroy sys-usb
###### Create a new Net VM
qvm-create --template $systemplate --label=red --net --mem=300 --vcpus=2 sys-net
# Disable PCI_Strictreset
# Attach PCI-Controllers  to AppVM
qvm-pci --add-class sys-net net
# Fix Wifi when waking up from Resume
# https://www.qubes-os.org/doc/wireless-troubleshooting
sleep 10s
qvm-run --auto sys-firewall 'xterm -e "sudo echo iwlmvm  >> 
/rw/config/suspend-module-blacklist && \
                                sudo echo iwlwifi >> 
/rw/config/suspend-module-blacklist "'
qvm-shutdown --wait --force sys-net
###### Create a new Firewall VM
qvm-create --template $systemplate --label=orange --proxy --mem=300 --vcpus=2 
sys-firewall
#  Set Net-VM
qvm-prefs sys-firewall -s netvm sys-net
###### Create a new USB Qube
qvm-create --template $systemplate --label=red --net --mem=1024 --vcpus=2 
sys-usb
# Disable PCI_Strictreset
qvm-prefs sys-usb -s pci_strictreset false
# Enable Autostart
qvm-prefs sys-usb -s autostart true
# Attach USB-Controllers  to AppVM
qvm-pci --add-class sys-usb usb
###### Start sys-vms
qvm-start sys-firewall
qvm-start sys-usb

4) create-default-sys-vms.sh
This script can be used to revert to the default sys-vms (based on the full 
fedora-25 default image, not the minimal image)

#!/bin/bash
###### Kill and remove existing vms
./qvm-destroy sys-firewall
./qvm-destroy sys-net
./qvm-destroy sys-usb
###### Create a new Net VM
qvm-create --template fedora-25 --label=red --net --mem=300 --vcpus=2 sys-net
# Disable PCI_Strictreset
# Attach PCI-Controllers  to AppVM
qvm-pci --add-class sys-net net
# Fix Wifi when waking up from Resume
# https://www.qubes-os.org/doc/wireless-troubleshooting
sleep 10s
qvm-run --auto sys-firewall 'xterm -e "sudo echo iwlmvm  >> 
/rw/config/suspend-module-blacklist && \
                                sudo echo iwlwifi >> 
/rw/config/suspend-module-blacklist "'
qvm-shutdown --wait --force sys-net
###### Create a new Firewall VM
qvm-create --template fedora-25 --label=orange --proxy --mem=300 --vcpus=2 
sys-firewall
#  Set Net-VM
qvm-prefs sys-firewall -s netvm sys-net
###### Create a new USB VM
qvm-create --template fedora-25 --label=red --net --mem=1024 --vcpus=2 sys-usb
# Disable PCI_Strictreset
qvm-prefs sys-usb -s pci_strictreset false
# Enable Autostart
qvm-prefs sys-usb -s autostart true
# Attach USB-Controllers  to AppVM
qvm-pci --add-class sys-usb usb
###### Start sys-vms
qvm-start sys-firewall
qvm-start sys-usb

If you have any further questions do not hesitate to contact me, if you want 
you can also send me a private email.

[799]

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/iuYCwf9fzxSQiixRUgonjNs68iB9sc4dg0cuRqGVQdCSgpWILc8IjLTq5MpTYF9D8Io6dLhmOiwWseiPeW27QfL0OCtfkTO4V4q8j_GN4B0%3D%40protonmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to