From 50162678eb467b16970a3bdeed0a477f08c4025c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 1 Sep 2018 12:16:01 +0200 Subject: Split utils to common and utils It is beneficial to use utils also in other processes but there were parts that should only job it self include. This splits those to two separate files. --- scripts/common | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/common (limited to 'scripts/common') diff --git a/scripts/common b/scripts/common new file mode 100644 index 0000000..7514ea9 --- /dev/null +++ b/scripts/common @@ -0,0 +1,23 @@ +# vim: ft=sh +# Laminar guard +if [ -z "$WORKSPACE" ]; then + echo "This script can be run only from laminar build environment!" >&2 + exit 1 +fi + +# Subprocess inclusion guard +[ -z "$LAMINAR_COMMON" ] +export LAMINAR_COMMON=y + +# Job and template id +export JOBID="$(basename "$0" | sed 's/\.run$//')" +export TEMPLATEID="$(basename "$(readlink -f "$0")" | sed 's/\.run$//')" + +# Template workspace +export TWORKSPACE="$HOME/workspace/$TEMPLATEID" +if [ "$JOBID" = "$TEMPLATEID" ]; then + TWORKSPACE="$HOME/workspace/notemplate" +fi + +# Include utils +. utils -- cgit v1.2.3