summaryrefslogtreecommitdiff
path: root/scripts/common
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-09-01 12:16:01 +0200
committerKarel Kočí <cynerd@email.cz>2018-09-01 12:18:31 +0200
commit50162678eb467b16970a3bdeed0a477f08c4025c (patch)
treead9ed5fecc2c9c4240b69ebf5c7815a8f9da7ab9 /scripts/common
parentd2044b1563dd50c6a26927955b767432e57e9865 (diff)
downloadlaminar-cnf-50162678eb467b16970a3bdeed0a477f08c4025c.tar.gz
laminar-cnf-50162678eb467b16970a3bdeed0a477f08c4025c.tar.bz2
laminar-cnf-50162678eb467b16970a3bdeed0a477f08c4025c.zip
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.
Diffstat (limited to 'scripts/common')
-rw-r--r--scripts/common23
1 files changed, 23 insertions, 0 deletions
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