From 6d2d25112c77bed27fe48871b90218f3c5936eaf Mon Sep 17 00:00:00 2001
From: kasravi1 <kasravi1@jpblt-s01-02.jupiter.internal>
Date: Thu, 5 Dec 2024 15:11:44 +0100
Subject: [PATCH] add group name into args

---
 scripts/build_customized_nvidia_image.sh | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/scripts/build_customized_nvidia_image.sh b/scripts/build_customized_nvidia_image.sh
index d6ee5f3..188d6ac 100644
--- a/scripts/build_customized_nvidia_image.sh
+++ b/scripts/build_customized_nvidia_image.sh
@@ -6,26 +6,28 @@ PARTITION_NAME=""
 SINGULARITY_BASE_IMG_PATH=""
 SINGULARITY_FINAL_IMG_NAME=""
 REQUIREMENT_PATH=""
+GROUP_NAME=""
 
 # Parse options
-while getopts "A:P:S:R:F:" opt; do
+while getopts "A:G:P:S:R:F:" opt; do
     echo "Processing option: $opt with argument: $OPTARG" # Add this for debugging
     case $opt in
         A) ACCOUNT_NAME=$OPTARG ;;
+        G) GROUP_NAME=$OPTARG ;;
         P) PARTITION_NAME=$OPTARG ;;
         S) SINGULARITY_BASE_IMG_PATH=$OPTARG ;;
         R) REQUIREMENT_PATH=$OPTARG ;;
         F) SINGULARITY_FINAL_IMG_NAME=$OPTARG ;;
         *)
-            echo "Usage: $0 -A <account_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>"
+            echo "Usage: $0 -A <account_name> -G <group_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>"
             exit 1
             ;;
     esac
 done
 
 # Check if required arguments are provided
-if [ -z "$ACCOUNT_NAME" ] || [ -z "$PARTITION_NAME" ] || [ -z "$SINGULARITY_BASE_IMG_PATH" ] || [ -z "$REQUIREMENT_PATH" ] || [ -z "$SINGULARITY_FINAL_IMG_NAME" ]; then
-    echo "Usage: $0 -A <account_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>"
+if [ -z "$ACCOUNT_NAME" ] || [ -z "$GROUP_NAME" ] || [ -z "$PARTITION_NAME" ] || [ -z "$SINGULARITY_BASE_IMG_PATH" ] || [ -z "$REQUIREMENT_PATH" ] || [ -z "$SINGULARITY_FINAL_IMG_NAME" ]; then
+    echo "Usage: $0 -A <account_name> -G <group_name> -P <partition_name> -S <singularity_base_image_path> -R <requirement.txt_path> F <singularity_image_name>"
     exit 1
 fi
 
@@ -62,7 +64,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
@@ -74,7 +76,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
-- 
GitLab