summaryrefslogtreecommitdiff
path: root/qmenu/qmenu_vm/fqvm_service
blob: cc8baaa3f54bb1a663138eeef1f06ed62c410e02 (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
services=1

while [ -n "$services" ]; do

	services=$(qvm-service "$qube" --list |	dmenu-unlinked -l 32 -p "$qube:" | cut -f1 -d\ )

	if [ -n "$services" ]; then

		for service in $services; do

			qvm-service "$qube" --list | grep -q "^$service " &&

				 unset='\nUnset'

			value=$(printf "Disable\nEnable$unset" | dmenu-unlinked -l 3 -i -p "Select value for '$service':")

			if [ "$value" = Disable ]; then

				qvm-service "$qube" "$service" off ||

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

			elif [ "$value" = Enable ]; then

				qvm-service "$qube" "$service" on ||

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

			elif [ "$value" = Unset ]; then

				qvm-service "$qube" "$service" --unset ||

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

			[ -n "$unset" ] && unset unset
		done
	fi
done