mig5 / qubes-scripts Goto Github PK
View Code? Open in Web Editor NEWA collection of helper scripts I use on dom0 in QubesOS
License: GNU General Public License v2.0
A collection of helper scripts I use on dom0 in QubesOS
License: GNU General Public License v2.0
Instead of trying to chop off or interpret the []{}=> symbols around vm names (which are intended for humans) you can use qvm-ls's --raw-data option to get parsing-friendly output. For example, to get the names of all templates, you could do:
list_templates() {
qvm-ls --raw-data name-raw type \
| while IFS='|' read name type; do
[ Tpl = "$type" ] && echo "$name"
done | sort
}
Using name-raw
instead of the human-intended name
is preferable because name
has additional symbols which you don't currently handle, and name-raw
avoids the need to handle any altogether.
in qvm-ls, name is constructed like this:
"name": {"func": "('=>' if qvm_collection.get_default_template() is not None\
and vm.qid == qvm_collection.get_default_template().qid else '')\
+ ('[' if vm.is_template() else '')\
+ ('<' if vm.is_disposablevm() else '')\
+ ('{' if vm.is_netvm() else '')\
+ vm.name \
+ (']' if vm.is_template() else '')\
+ ('>' if vm.is_disposablevm() else '')\
+ ('}' if vm.is_netvm() else '')"},
Note that <
>
are also valid, and not handled by your:
TEMPLATES=$(qvm-ls --raw-data name | grep "\\[" | tr -d {}[]=\> | sort)
In your current code, <> could be left in and passed as name arguments, and in your case due to lack of quoting potentially lead to unintended io redirection to files named by running DisposableVMs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.