diff options
Diffstat (limited to 'qmenu/qmenu_vm/fqvm_clone')
-rw-r--r-- | qmenu/qmenu_vm/fqvm_clone | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/qmenu/qmenu_vm/fqvm_clone b/qmenu/qmenu_vm/fqvm_clone new file mode 100644 index 0000000..d31b297 --- /dev/null +++ b/qmenu/qmenu_vm/fqvm_clone @@ -0,0 +1,39 @@ +clone_name=$(: | dmenu-unlinked -p "Enter the name for the clone of $qube:") && + + option=1 + + while [ -n "$option" ]; do + + option=$(printf 'Create the clone\nAdvanced options' | dmenu-unlinked -i -l 2 -p "$qube:" | cut -f1 -d\ ) + + if [ "$option" = Advanced ]; then + + option_adv=1 + + while [ -n "$option_adv" ]; do + + option_adv=$(printf 'Class\nPool' | dmenu-unlinked -i -l 2 -p "$clone_name($qube):") + + if [ "$option_adv" = Class ]; then + + class=$(printf 'AppVM\nDispVM\nStandaloneVM\nTemplateVM' | dmenu-unlinked -i -l 4 -p "Choose a class for $clone_name:") && + + class="-C $class" + + elif [ "$option_adv" = Pool ]; then + + pool=$(qvm-pool --list | sed '1d' | dmenu-unlinked -i -l 10 -p "Select a pool for $clone_name:" | cut -f1 -d\ ) && + + pool="-P $pool" + fi + done + + elif [ "$option" = Create ]; then + + unset option + + cp -n "$HOME/.local/share/qubes-notes/$qube" "$HOME/.local/share/qubes-notes/$clone_name" + + qvm-clone $class $pool "$qube" "$clone_name"& + fi + done |