aboutsummaryrefslogtreecommitdiff
path: root/config/config_utils.in
diff options
context:
space:
mode:
Diffstat (limited to 'config/config_utils.in')
-rw-r--r--config/config_utils.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/config/config_utils.in b/config/config_utils.in
new file mode 100644
index 00000000..cc52ca1d
--- /dev/null
+++ b/config/config_utils.in
@@ -0,0 +1,7 @@
+# $(if-success,<command>,<then>,<else>)
+# Return <then> if <command> exits with 0, <else> otherwise.
+if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
+
+# $(success,<command>)
+# Return y if <command> exits with 0, n otherwise
+success = $(if-success,$(1),y,n)