From a63ed0801a341499e20ff6e3ecc8b8b685b15c44 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 23 Feb 2026 13:44:29 -0500 Subject: Initial commit --- tasks/task.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tasks/task.sh (limited to 'tasks/task.sh') diff --git a/tasks/task.sh b/tasks/task.sh new file mode 100644 index 0000000..5a0ff09 --- /dev/null +++ b/tasks/task.sh @@ -0,0 +1,44 @@ +common_dir=$(realpath $(dirname ${BASH_SOURCE[0]})/common) + +task=$1 +if [ -z "$task" ]; then + echo "task directory required" >&2 + exit 1 +fi + +if ! [ -d "$task" ]; then + echo "task directory does not exist: ${task}" >&2 + exit 1 +fi + +if [ -f "$task"/env.sh ]; then + source "$task"/env.sh +fi + +if ! [ -f "$task"/run.sh ]; then + echo "missing script: ${task}/run.sh" + exit 1 +fi + +source ${common_dir}/functions.sh +source "$task"/run.sh + +task_func=( + pre + run + post +) + +for x in "${task_func[@]}"; do + step="${task}::${x}()" + echo + echo "[$step] Executing" + ${x} + retval=$? + if (( $retval )); then + echo "[$step] Failed (returned $retval)" >&2 + exit 1 + fi + echo +done +echo "Done!" -- cgit