missing commands/options for scripting in Qubes OS (3.2)

19 views
Skip to first unread message

One7two99

unread,
Sep 27, 2017, 6:12:17 AM9/27/17
to qubes-users
Hello,

while trying to script some basic tasks I found out that I am missing some small features in the qvm-* scripts, I have looked at the code of those script but it is to hard for me to understand exactly what needs to be done to chance that.
Here my ideas, maybe someone with more skills is able to do so:

*** qvm-shutdown ***
should have an option like "skip-if-not-running", so that the command will not throw out the message "ERROR: VM already stopped"
Another options should be "skip-if-not-exist"

*** qvm-restart ***
will shutdown and restart a VM.
should also have an option like "skip-if-not-running","start-if-not-running", "skip-if-not-exist" and "wait".
(the usecase of those options are clear I guess :-)
I've written a script and saved it to /usr/bin which is only shutting down and starting a VM, but not doing any error checking, nor does it offer further options:
#! /bin/bash
qvm-shutdown --force --wait $1
qvm-start $1

*** qvm-destroy ***
including options: "skip-if-not-exist" and "wait"
Will kill a running VM and remove it (basically qvm-kill and then qvm-remove)

*** qvm-check ***
should have two other options:
qvm-check shutdown <VM-Name>
qvm-check exists <VM-Name>

Another great feature would be if dom0 gets an information when a scripts has been finished in an AppVM if has been started via qvm-run:

currently I am forcing the user to monitor if a command has been finished:

qvm-run <APP-VM> 'xterm -e "<COMMAND 1> && <COMMAND 2>'"
echo "WARNING: Only continue if the former command has been finished (terminal windows has been closed)"
read -p "Press Enter to continue"

Something like "--wait" would be great. I know that this might not be that easy, but I guess there could be a way that the AppVM communicates back to dom0.

Maybe some of this is covered in Qubes 4.x, this would also be nice to know, still I think it would also be great if this is available in Qubes 3.2

I
[799]

Johannes Graumann

unread,
Sep 27, 2017, 7:09:46 AM9/27/17
to One7two99, qubes-users
I strongly second these requests - the 'qvm-shutdown --skip-if-not-
running' can in fact be found in this mailing list as an earlier
request from myself.
My entire qubes setup is ansible maintained and making scripting easier
as proposed here would cut out many lines of code.

Sincerely, Joh

One7two99

unread,
Sep 27, 2017, 7:19:09 AM9/27/17
to Johannes Graumann, qubes-users
Hello Johannes,


-------- Original Message --------
Subject: Re: [qubes-users] missing commands/options for scripting in Qubes OS (3.2)
Local Time: September 27, 2017 1:09 PM

I strongly second these requests - the "qvm-shutdown --skip-if-not-
running" can in fact be found in this mailing list as an earlier
request from myself.
My entire qubes setup is ansible maintained and making scripting easier
as proposed here would cut out many lines of code.

I am very interested at what kind of tasks you've automated or try to script, also to shae possible good approachs to do so.
I have very basic scripting skills but if done right investing time in scripts will most time  pay off.
Would like to see this stuff shared here or within the documentation.

[799]
Reply all
Reply to author
Forward
0 new messages