summaryrefslogtreecommitdiff
path: root/qmenu/qmenu_vm/fqvm_clone
blob: d31b297ade99ab72f06a6d69e44bca5708051231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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