From 01a33ab0913d439150065ac23644c4f140ff8917 Mon Sep 17 00:00:00 2001 From: Casper Date: Mon, 23 Dec 2024 17:13:45 -0700 Subject: added qmenu! --- qmenu/qmenu_vm/fqvm_create | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 qmenu/qmenu_vm/fqvm_create (limited to 'qmenu/qmenu_vm/fqvm_create') diff --git a/qmenu/qmenu_vm/fqvm_create b/qmenu/qmenu_vm/fqvm_create new file mode 100644 index 0000000..b1990da --- /dev/null +++ b/qmenu/qmenu_vm/fqvm_create @@ -0,0 +1,77 @@ +name=$(: | dmenu-unlinked -p "Enter the name for the new qube:") && + + label=$(printf 'Red\nOrange\nYellow\nGreen\nGray\nBlue\nPurple\nBlack' | dmenu-unlinked -i -l 8 -p "Select label for $name:" | awk '{print tolower($0)}') + + if [ -n "$label" ]; then + + QUBEARGS="-l $label" + + class=$(printf 'AppVM\nStandaloneVM\nTemplateVM' | dmenu-unlinked -i -l 4 -p "Choose a class for $name:") + + QUBEARGS="$QUBEARGS -C $class" + + get_list template + + if [ "$class" = 'AppVM' ]; then + + template=$(printf "(Default)\n$list" | dmenu-unlinked -l 50 -p "Select template for $name:") + + [ "$template" = '(Default)' ] && unset template + + else + template=$(printf "(None)\n$list" | dmenu-unlinked -l 50 -p "Select template that $name will be copied from:") + + [ "$template" = '(None)' ] && unset template + fi + + [ -n "$template" ] && QUBEARGS="$QUBEARGS -t $template" + + get_list netvm + + netvm=$(printf "(Default)\n(None)\n$list" | dmenu-unlinked -l 50 -p "Select netvm for $name:") + + if [ "$netvm" = '(Default)' ]; then netvm=--default + elif [ "$netvm" = '(None)' ]; then unset netvm + fi + + QUBEARGS="$QUBEARGS --prop netvm=$netvm" + + provides_network=$(printf 'No\nYes' | dmenu-unlinked -i -p "Should $name provide networking for other qubes?") + + if [ "$provides_network" = Yes ]; then + + QUBEARGS="$QUBEARGS --prop provides_network=true" + fi + + option=1 + + while [ -n "$option" ]; do + + option=$(printf 'Create the new qube\nAdvanced options' | dmenu-unlinked -i -l 2 -p "dom0:" | cut -f1 -d\ ) + + if [ "$option" = Advanced ]; then + + option_adv=$(printf Pool | dmenu-unlinked -l 1 -p "$name:") + + if [ "$option_adv" = Pool ]; then + + pool=$(qvm-pool --list | sed '1d' | dmenu-unlinked -i -l 10 -p "Select a pool for $name:" | cut -f1 -d\ ) + + [ -n "$pool" ] && pool="-P $pool" + fi + + elif [ "$option" = Create ]; then + + qvm-create $QUBEARGS $pool "$name" + + if [ "$class" = 'StandaloneVM' ] && [ -z "$template" ]; then + + qvm-prefs "$name" kernel '' + qvm-prefs "$name" virt_mode hvm + qvm-prefs "$name" maxmem 0 + fi + + unset option + fi + done + fi -- cgit v1.2.3