aboutsummaryrefslogtreecommitdiff
path: root/utils/ops
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-09-20 21:19:05 +0200
committerKarel Kočí <cynerd@email.cz>2017-09-20 21:22:36 +0200
commitf287ecedc78c0cc8fb485c5995b8d1cfae9f0fe8 (patch)
tree5025b33a8c3d4c69ad2b62e1169b669c56f712f9 /utils/ops
parent65f52ead41dc6df73671ddd3a8c6a2edecb6dfb3 (diff)
downloadmulticonfig-complicated.tar.gz
multiconfig-complicated.tar.bz2
multiconfig-complicated.zip
Commit current statecomplicated
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"
+}