diff --git a/scripts/build_base_image.sh b/scripts/build_base_image.sh index 1dbb747e2c7a509fca0502e0438032beea947182..cd10c615e99b1d4eb570f55d0724b89b22997606 100644 --- a/scripts/build_base_image.sh +++ b/scripts/build_base_image.sh @@ -5,24 +5,26 @@ ACCOUNT_NAME="" PARTITION_NAME="" PYTHON_VERSION="" SINGULARITY_IMG_NAME="" +GROUP_NAME="" # Parse options -while getopts "A:P:V:N:" opt; do +while getopts "A:G:P:V:N:" opt; do case $opt in A) ACCOUNT_NAME=$OPTARG ;; + G) GROUP_NAME=$OPTARG ;; P) PARTITION_NAME=$OPTARG ;; V) PYTHON_VERSION=$OPTARG ;; N) SINGULARITY_IMG_NAME=$OPTARG ;; *) - echo "Usage: $0 -A <account_name> -P <partition_name> -V <python_version> -N <singularity_name>" + echo "Usage: $0 -A <account_name> -G <group_name> -P <partition_name> -V <python_version> -N <singularity_name>" exit 1 ;; esac done # Check if required arguments are provided -if [ -z "$ACCOUNT_NAME" ] || [ -z "$PARTITION_NAME" ] || [ -z "$PYTHON_VERSION" ] || [ -z "$SINGULARITY_IMG_NAME" ]; then - echo "Usage: $0 -A <account_name> -P <partition_name> -V <python_version> -N <singularity_name>" +if [ -z "$ACCOUNT_NAME" ] || [ -z "$GROUP_NAME" ] || [ -z "$PARTITION_NAME" ] || [ -z "$PYTHON_VERSION" ] || [ -z "$SINGULARITY_IMG_NAME" ]; then + echo "Usage: $0 -A <account_name> -G <group_name> -P <partition_name> -V <python_version> -N <singularity_name>" exit 1 fi @@ -46,7 +48,7 @@ module load Stages module try-load GCC Apptainer-Tools # Define the directory path -DIR="/p/project1/${ACCOUNT_NAME}/${USER}/apptainer" +DIR="/p/project1/${GROUP_NAME}/${USER}/apptainer" # Ensure directory exists if [ ! -d "\$DIR" ]; then @@ -58,7 +60,7 @@ else fi # Create temporary directory for Apptainer build -TMP=\$(mktemp -p /p/scratch/${ACCOUNT_NAME}/apptainer -d) || { echo "Failed to create temporary directory"; exit 1; } +TMP=\$(mktemp -p /p/scratch/${GROUP_NAME}/apptainer -d) || { echo "Failed to create temporary directory"; exit 1; } export APPTAINER_TMPDIR=\$TMP # Create the Singularity definition file in TMP