aboutsummaryrefslogtreecommitdiff
path: root/utils/ops
blob: 1365ec88f54581d5d3d15e319991cde5ab750f68 (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
# vim:ft=sh:noexpandtab
# Utility functions for operations

# Set operation we are working on
ops_set_current() {
	OPERATION_CURRENT="$1"
}

ops_require() {
	while [ $# -gt 0 ]; do
		dict_set "ops/$OPERATION_CURRENT" "$1" true
		shift
	done
}

ops_required_any() {
	if ! dict_empty "ops/$OPERATION_CURRENT"; then
		echo_warn "$1 requires update for following components: $(ops_required_list)"
	else
		return 1
	fi
}

ops_is_required() {
	dict_contains "ops/$OPERATION_CURRENT" "$1"
}

ops_required_list() {
	dict_keys "ops/$OPERATION_CURRENT"
}