Den 2017-03-01 kl. 06:41, skrev [email protected]:
> I tend to use Qubes VM's not just for security purposes, but also as a very 
> convenient way to have clean, manageable VM's where I only install the stuff 
> I need for a specific task.
> 
> This has led me to have a large number non-template VM's, all of which needs 
> to be manually updated every time there is a software update.
> 
> Right now, for each VM, I have to click on update, wait for the dialogue box 
> to spin for a while waiting for the VM to start, then manually choose “yes” 
> to update. This process gets old really fast.
> 
> Is there a way to automate this so that I can simply say “yes, I want to 
> update all these VM's, go ahead and do it”?
> 
> Regards,
> Elias
> 

I got a Python script for that. Put in dom0 and run it. Unlike Andrews
script this one will update all VMs in parallel and is interactive
rather than non-interactive.

https://gist.github.com/JimmyAx/818bcf11a14e85531516ef999c8c5765


Here it is, embedded in the email:



#!/usr/bin/python2

import subprocess

from time import sleep

from qubes.qubes import QubesVmCollection


if __name__ == "__main__":
    qvm_collection = QubesVmCollection()
    qvm_collection.lock_db_for_reading()
    try:
        qvm_collection.load()
    finally:
        qvm_collection.unlock_db()

    vms = qvm_collection.values()

    exclude_vms = ("debian-8-hvm", "win7", "win7-orig")
#"archlinux-aur", "archlinux")

    processes = []
    for vm in vms:
        dom0 = vm.qid == 0
        if not dom0 and vm.updateable and vm.name not in exclude_vms:
            print "Updating VM template %s..." % vm.name
            if not vm.is_running():
                vm.start()
            sleep(3)
            p = vm.run_service("qubes.InstallUpdatesGUI", gui=True,
wait=False, passio_popen=True)
            processes.append((vm, p))

    print "Waiting for VMs to complete updating..."
    for vm, p in processes:
        p.wait()
        if vm.is_running():
            vm.shutdown()

    subprocess.check_call(["sudo", "/usr/bin/qubes-dom0-update"])

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/9150dbaa-6783-f57c-611a-5bef296da163%40axenhus.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to