From 9d317fdb62da7106fdbe279458d1ae61153f74b4 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Wed, 17 Jul 2024 12:14:53 -0500 Subject: [PATCH] handle more edge cases for dir --- call_host.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/call_host.sh b/call_host.sh index 743c2d8..1d3c240 100755 --- a/call_host.sh +++ b/call_host.sh @@ -19,8 +19,17 @@ if [ -z "$CALL_HOST_DIR" ]; then export CALL_HOST_STATUS=disable fi fi -export CALL_HOST_DIR=$(readlink -f "$CALL_HOST_DIR") -mkdir -p "$CALL_HOST_DIR" +CALL_HOST_DIR_ORIG="$CALL_HOST_DIR" +export CALL_HOST_DIR=$(readlink -f "$CALL_HOST_DIR_ORIG") +if [ -z "$CALL_HOST_DIR" ]; then + echo "Warning: readlink -f failed for CALL_HOST_DIR $CALL_HOST_DIR_ORIG. disabling" + export CALL_HOST_STATUS=disable +elif [ ! -d "$CALL_HOST_DIR" ]; then + echo "Warning: specified dir CALL_HOST_DIR $CALL_HOST_DIR does not exist. disabling" + export CALL_HOST_STATUS=disable +else + mkdir -p "$CALL_HOST_DIR" +fi # ensure the pipe dir is bound export APPTAINER_BIND=${APPTAINER_BIND}${APPTAINER_BIND:+,}${CALL_HOST_DIR}