aboutsummaryrefslogtreecommitdiff
path: root/utils/ops
diff options
context:
space:
mode:
Diffstat (limited to 'utils/ops')
-rw-r--r--utils/ops30
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/ops b/utils/ops
new file mode 100644
index 0000000..1365ec8
--- /dev/null
+++ b/utils/ops
@@ -0,0 +1,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"
+}