blob: 5a0ff0940b2a25bd41bc0a99f2d5021bb6d6255b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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!"
|