summaryrefslogtreecommitdiff
path: root/qmenu/qmenu_vm/fqubes_prefs
blob: 25702250874e8b7a0ee665bc1b91ff512731056f (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
property=1

while [ -n "$property" ]; do

	property=$(qubes-prefs | dmenu-unlinked -l 16 -p "Global preferences:" | cut -f1 -d\ )

	case $property in

		check_updates_vm)

			value=$(printf 'False\nTrue' | dmenu-unlinked -i -p "Should the system periodically check for domU updates?");;

		clockvm)

			get_list netvm

			value=$(printf "(None)\n$list" | dmenu-unlinked -l 50 -p "Select ClockVM:");;

		default_dispvm)

			if [ -z "$LIST_DISPTEMP" ]; then

				# [mediocre] Look up disposable templates in a very slow way because qvm-ls does not offer a flag for them
				for n in $(qvm-ls --raw-data -O NAME,FLAGS | grep '|a.....-.$' | cut -d '|' -f1); do

					qvm-prefs "$n" template_for_dispvms | grep -q True &&

						LIST_DISPTEMP="$LIST_DISPTEMP\n$n"
				done
			fi

			value=$(printf "(None)$LIST_DISPTEMP" | dmenu-unlinked -l 50 -p "Select default dispvm:");;

		default_kernel)

			value=$(echo '(None)' | dmenu-unlinked -l 2 -p "Enter default kernel:") &&

				nyprompt "Set default kernel to $value?" || unset value;;

		default_netvm)

			get_list netvm

			value=$(printf "(None)\n$list" | dmenu-unlinked -l 50 -p "Select default netvm:");;

		default_pool)

			value=$(qvm-pool --list | sed '1d' | dmenu-unlinked -i -l 30 -p "Select default storage pool:" | cut -f1 -d\ );;

		default_pool_kernel)

			value=$(qvm-pool --list | sed '1d' | dmenu-unlinked -i -l 30 -p "Select default storage pool for kernel volumes:" | cut -f1 -d\ );;

		default_pool_private)

			value=$(qvm-pool --list | sed '1d' | dmenu-unlinked -i -l 30 -p "Select default storage pool for private volumes:" | cut -f1 -d\ );;

		default_pool_root)

			value=$(qvm-pool --list | sed '1d' | dmenu-unlinked -i -l 30 -p "Select default storage pool for root volumes:" | cut -f1 -d\ );;

		default_pool_volatile)

			value=$(qvm-pool --list | sed '1d' | dmenu-unlinked -i -l 30 -p "Select default storage pool for volatile volumes:" | cut -f1 -d\ );;

		default_qrexec_timeout)

			value=$(qubes-prefs default_qrexec_timeout | dmenu-unlinked -p "Enter the time in seconds, after which qrexec connection attempts are deemed a failure:");;

		default_shutdown_timeout)

			value=$(qubes-prefs default_shutdown_timeout | dmenu-unlinked -p "Enter the default time in seconds for qube shutdowns to complete:");;

		default_template)

			get_list template

			value=$(printf "(None)\n$list" | dmenu-unlinked -l 50 -p "Select default template:");;

		management_dispvm)

			get_list mgmt_disptemp

			value=$(printf "(None)\n$list" | dmenu-unlinked -l 50 -p "Select management dispvm:");;

		stats_interval)

			value=$(: | dmenu-unlinked -p "Enter interval in seconds for qube stats reporting:");;

		updatevm)

			get_list netvm

			value=$(printf "(None)\n$list" | dmenu-unlinked -l 50 -p "Select UpdateVM for dom0:");;

		*)
	esac

	if [ -n "$value" ]; then

		[ "$value" = '(None)' ] && value=''

		qubes-prefs "$property" "$value" ||

			echo Go back... | dmenu-unlinked -p "Error: Failed to set $property to '$value'!" > /dev/null 2>&1

		unset value
	fi
done