Skip to content

Commit

Permalink
use directory of called script as base dir for other scripts in bot/i…
Browse files Browse the repository at this point in the history
…nspect.sh
  • Loading branch information
Richard Top committed Jun 7, 2024
1 parent fe46b1f commit 9339f89
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions bot/inspect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
# stop as soon as something fails
set -e

# script_dir is the directory that contains THIS (inspect.sh) script, usually
# stored in the directory '.../bot'
script_dir=$(dirname $(realpath $BASH_SOURCE))

display_help() {
echo "usage: $0 [OPTIONS]"
echo " -h | --help - display this usage information"
Expand Down Expand Up @@ -81,8 +85,8 @@ done
set -- "${POSITIONAL_ARGS[@]}"

# source utils.sh and cfg_files.sh
source scripts/utils.sh
source scripts/cfg_files.sh
source ${script_dir}/../scripts/utils.sh
source ${script_dir}/../scripts/cfg_files.sh

if [[ -z ${resume_tgz} ]]; then
echo_red "path to tarball for resuming build job is missing"
Expand Down Expand Up @@ -255,10 +259,8 @@ CMDLINE_ARGS+=("--storage" "${JOB_STORAGE}")

# make sure some environment settings are available inside the shell started via
# startprefix
base_dir=$(dirname $(realpath $0))
# base_dir of inspect.sh script is '.../bot', 'init' dir is at the same level
# TODO better use script from tarball???
source ${base_dir}/../init/eessi_defaults
source ${script_dir}/../init/eessi_defaults

if [ -z $EESSI_VERSION ]; then
echo "ERROR: \$EESSI_VERSION must be set!" >&2
Expand Down Expand Up @@ -432,14 +434,14 @@ echo "Executing command to start interactive session to inspect build job:"
# These initializations are combined into a single script that is executed when
# the shell in startprefix is started. We set the env variable BASH_ENV here.
if [[ -z ${run_in_prefix} ]]; then
echo "./eessi_container.sh ${CMDLINE_ARGS[@]}"
echo "${script_dir}/../eessi_container.sh ${CMDLINE_ARGS[@]}"
echo " -- ${EESSI_COMPAT_LAYER_DIR}/startprefix"
./eessi_container.sh "${CMDLINE_ARGS[@]}" \
${script_dir}/../eessi_container.sh "${CMDLINE_ARGS[@]}" \
-- ${EESSI_COMPAT_LAYER_DIR}/startprefix
else
echo "./eessi_container.sh ${CMDLINE_ARGS[@]}"
echo "${script_dir}/../eessi_container.sh ${CMDLINE_ARGS[@]}"
echo " -- ${EESSI_COMPAT_LAYER_DIR}/startprefix <<< ${run_in_prefix}"
./eessi_container.sh "${CMDLINE_ARGS[@]}" \
${script_dir}/../eessi_container.sh "${CMDLINE_ARGS[@]}" \
-- ${EESSI_COMPAT_LAYER_DIR}/startprefix <<< ${run_in_prefix}
fi

Expand Down

0 comments on commit 9339f89

Please sign in to comment.