summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/fifa.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/fifa.sh b/src/fifa.sh
index 0a9c445..3c1de6c 100755
--- a/src/fifa.sh
+++ b/src/fifa.sh
@@ -106,6 +106,9 @@ load_lib ()
}
+# $1 phase/worker
+# $2 phase/worker name
+# $3... extra args for phase/worker (optional)
execute ()
{
[ -z "$1" -o -z "$2" ] && die_error "Use the execute function like this: execute <type> <name> with type=phase/worker"
@@ -157,6 +160,23 @@ execute ()
}
+# check if a phase/worker executed sucessfully
+# returns 0 if ok, the phase/workers' exit state otherwise (and returns 1 if not executed yet)
+# $1 phase/worker
+# $2 phase/worker name
+ended_ok ()
+{
+ [ -z "$1" -o -z "$2" ] && die_error "Use the ended_ok function like this: ended_ok <type> <name> with type=phase/worker"
+ [ "$1" != phase -a "$1" != worker ] && die_error "ended_ok's first argument must be a valid type (phase/worker)"
+ object=$1_$2
+ exit_var=exit_$object
+ debug "Exit state of $objecct was: ${!exit_var} (if empty. it's not executed yet)"
+ [ "${!exit_var}" = '0' ] && return 0
+ [ "${!exit_var}" = '' ] && return 1
+ return ${!exit_var}
+}
+
+
depend_module ()
{
load_module "$1"