diff options
author | Karel Kočí <cynerd@email.cz> | 2018-09-07 17:18:29 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-09-07 17:18:29 +0200 |
commit | aa508028036ea01683b07cb9fc2812dc35bc9b65 (patch) | |
tree | 8334be3d7e2817281b857e8f450291a3504856fa /fakelaminar | |
parent | 901d7020373e43d441fea5ab8f14492026b66671 (diff) | |
download | laminar-cnf-aa508028036ea01683b07cb9fc2812dc35bc9b65.tar.gz laminar-cnf-aa508028036ea01683b07cb9fc2812dc35bc9b65.tar.bz2 laminar-cnf-aa508028036ea01683b07cb9fc2812dc35bc9b65.zip |
Add fake laminar execution possibility
Diffstat (limited to 'fakelaminar')
-rw-r--r-- | fakelaminar | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/fakelaminar b/fakelaminar new file mode 100644 index 0000000..4401960 --- /dev/null +++ b/fakelaminar @@ -0,0 +1,55 @@ +# vim: ft=sh +# Fake laminar environment to be able to do test run on any host + +# Make sure that we are running this script with absolute path +echo "$0" | grep -q '^/' || exec "$(pwd)/$0" + +# Add path to scripts +export PATH="$(dirname "$(readlink -f "$0")")/../scripts:$PATH" + +# Note: Changing home variable relly changes home directory to local laminar-fake. +# This does not work for all commands and specially for ssh it does not but we +# require this because thanks to that we don't have to setup ssh configuration +# copy. +export HOME="$PWD/laminar-fake" +mkdir -p "$HOME" + +# Create link to configuration directory +rm -f "$HOME/cfg" +ln -s "$(dirname $(readlink -f "$0"))/.." "$HOME/cfg" + +# Get name of the job from script name +export JOB="$(basename "$0" | sed 's/\.run$//')" + +JOBDIR="$HOME/run/$JOB" +mkdir -p "$JOBDIR" + +# Set run number +export RUN="$(ls "$JOBDIR" | sed -n '/^[0-9]\+$/p' | sort --numeric-sort | tail -1)" +RUN="${RUN:-0}" +RUN="$(expr "$RUN" + 1)" +# Create directory for this run +mkdir -p "$JOBDIR/$RUN" +cd "$JOBDIR/$RUN" + +# Set workspace +export WORKSPACE="$JOBDIR/workspace" +mkdir -p "$WORKSPACE" + +# Set archive +export ARCHIVE="$HOME/archive/$JOB/$RUN" +mkdir -p "$ARCHIVE" + +# TODO missing variables: RESULT, LAST_RESULT + +# Drop JOBDIR variable +JOBDIR= + + +# Fake laminarc command +laminarc() { + # TODO this is currently not supported but we should implement it in future. + false +} + +echo "========== Laminar environment is faked ==========" |