From 96e690705aa608ddcd7f1ffcb8b70d199c939e44 Mon Sep 17 00:00:00 2001
From: easybuild <you@example.com>
Date: Mon, 16 Jan 2023 11:07:50 +0100
Subject: [PATCH] fix

---
 bin/image-exec   |  2 +-
 bin/image-load   | 22 +++++++++++-----------
 bin/image-mpi    |  4 +---
 bin/image-run    |  2 +-
 bin/image-shell  |  2 +-
 bin/image-update | 10 +++++-----
 6 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/bin/image-exec b/bin/image-exec
index 185638a..21c201f 100755
--- a/bin/image-exec
+++ b/bin/image-exec
@@ -10,4 +10,4 @@ if [ -z "$1" ]; then
     exit 1
 fi
 
-singularity exec --bind /scratch --bind /apps $IMAGE_PATH_LOCAL "$@"
+apptainer exec --bind /scratch --bind /apps $IMAGE_PATH_LOCAL "$@"
diff --git a/bin/image-load b/bin/image-load
index 97b1872..214a700 100755
--- a/bin/image-load
+++ b/bin/image-load
@@ -7,15 +7,15 @@ fi
 
 VERSION=$(\ls -t $IMAGE_ROOT | grep ".sif\|.simg" | head -1)
 
-if [ ! -d "$HOME/.singularity/images" ]; then
-   mkdir -p $HOME/.singularity/images
+if [ ! -d "$HOME/.apptainer/images" ]; then
+   mkdir -p $HOME/.apptainer/images
 fi
 
-LOCAL=$(\ls $HOME/.singularity/images | grep $IMAGE_OS-$IMAGE_VERSION | head -1)
+LOCAL=$(\ls $HOME/.apptainer/images | grep $IMAGE_OS-$IMAGE_VERSION | head -1)
 
 if [[ -z "$LOCAL" ]]; then
    echo -ne "\e[33mPreparing image \e[0m"
-   rsync --progress -h $IMAGE_ROOT/$VERSION $HOME/.singularity/images/$VERSION
+   rsync --progress -h $IMAGE_ROOT/$VERSION $HOME/.apptainer/images/$VERSION
    LOCAL=$VERSION
 fi
 
@@ -25,9 +25,9 @@ if [ "$LOCAL" \< "$VERSION" ]; then
       read CONTINUE
       if [ "$CONTINUE" == "y" ] || [ "$CONTINUE" == "Y" ]; then
         echo -ne "\e[32mUpdating image\e[0m "
-        rsync --progress -h $IMAGE_ROOT/$VERSION $HOME/.singularity/images/$VERSION
-        echo -e "\e[32mNew version is ready.\e[0m ($HOME/.singularity/images/$VERSION)"
-        [ -f $HOME/.singularity/images/$LOCAL ] && rm $HOME/.singularity/images/$LOCAL
+        rsync --progress -h $IMAGE_ROOT/$VERSION $HOME/.apptainer/images/$VERSION
+        echo -e "\e[32mNew version is ready.\e[0m ($HOME/.apptainer/images/$VERSION)"
+        [ -f $HOME/.apptainer/images/$LOCAL ] && rm $HOME/.apptainer/images/$LOCAL
         LOCAL=$VERSION
       else
         echo -e "\e[31mIgnoring new version...\e[0m ($VERSION)."
@@ -38,11 +38,11 @@ if [ "$LOCAL" \< "$VERSION" ]; then
 fi
 
 if [ "$1" == "shell" ]; then
-  export IMAGE_PATH_LOCAL="$HOME/.singularity/images/$LOCAL"
-  singularity shell --bind /scratch --bind /apps $HOME/.singularity/images/$LOCAL
+  export IMAGE_PATH_LOCAL="$HOME/.apptainer/images/$LOCAL"
+  apptainer shell --bind /scratch --bind /apps $HOME/.apptainer/images/$LOCAL
   SYS=`/bin/cat /etc/centos-release`
   echo -e "\e[33mWelcome to the normal operating system ($SYS)\e[0m"
 else
-  export IMAGE_PATH_LOCAL="$HOME/.singularity/images/$LOCAL"
-  echo -e "\e[33mYour image of $IMAGE_OS/$IMAGE_VERSION is at location:\e[0m $HOME/.singularity/images/$LOCAL"
+  export IMAGE_PATH_LOCAL="$HOME/.apptainer/images/$LOCAL"
+  echo -e "\e[33mYour image of $IMAGE_OS/$IMAGE_VERSION is at location:\e[0m $HOME/.apptainer/images/$LOCAL"
 fi
diff --git a/bin/image-mpi b/bin/image-mpi
index 9b01b15..a03b64d 100755
--- a/bin/image-mpi
+++ b/bin/image-mpi
@@ -48,6 +48,4 @@ done
 
 PARAM=$(echo "$PARAM" | sed -e 's/  */ /g' -e 's/^ *\(.*\) *$/\1/')
 
-#echo "mpirun $PARAM singularity exec --bind /scratch --bind /apps --writable $IMAGE_PATH_LOCAL $EXEC"
-
-mpirun ${PARAM} singularity exec --bind /scratch --bind /apps "$IMAGE_PATH_LOCAL" "$EXEC"
+mpirun ${PARAM} apptainer exec --bind /scratch --bind /apps "$IMAGE_PATH_LOCAL" "$EXEC"
diff --git a/bin/image-run b/bin/image-run
index aef7595..012b4af 100755
--- a/bin/image-run
+++ b/bin/image-run
@@ -5,4 +5,4 @@ if [ -z "IMAGE_PATH_LOCAL" ]; then
     exit 1
 fi
 
-singularity run --bind /scratch --bind /apps $IMAGE_PATH_LOCAL "$@"
+apptainer run --bind /scratch --bind /apps $IMAGE_PATH_LOCAL "$@"
diff --git a/bin/image-shell b/bin/image-shell
index 88ca172..fee739d 100755
--- a/bin/image-shell
+++ b/bin/image-shell
@@ -5,4 +5,4 @@ if [ -z "IMAGE_PATH_LOCAL" ]; then
     exit 1
 fi
 
-singularity shell --bind /scratch --bind /apps $IMAGE_PATH_LOCAL $@
+apptainer shell --bind /scratch --bind /apps $IMAGE_PATH_LOCAL $@
diff --git a/bin/image-update b/bin/image-update
index 9442069..bb536b9 100755
--- a/bin/image-update
+++ b/bin/image-update
@@ -7,18 +7,18 @@ fi
 
 APPS_VERSION=$(ls -t $IMAGE_ROOT | grep ".sif\|.simg" | head -1)
 
-LOCAL_VERSION=$(ls $HOME/.singularity/images | grep $IMAGE_OS-$IMAGE_VERSION* | head -1)
+LOCAL_VERSION=$(ls $HOME/.apptainer/images | grep $IMAGE_OS-$IMAGE_VERSION* | head -1)
 
 if [ "$LOCAL_VERSION" \< "$APPS_VERSION" ]; then
     echo -ne "\e[33mNew version of CentOS image was found.\e[0m (\e[33mNew:\e[0m $APPS_VERSION \e[33mOld:\e[0m $LOCAL_VERSION)\nDo you want to update local copy? (\e[31mWARNING all user modification will be deleted\e[0m) [y/N]: "
     read CONTINUE
     if [ "$CONTINUE" == "y" ] || [ "$CONTINUE" == "Y" ]; then
         echo -ne "\e[33mUpdating image \e[0m "
-        rsync --progress -h $IMAGE_ROOT/$APPS_VERSION $HOME/.singularity/images/$APPS_VERSION
-        echo -e "\e[32mNew version is ready.\e[0m ($HOME/.singularity/images/$APPS_VERSION)"
+        rsync --progress -h $IMAGE_ROOT/$APPS_VERSION $HOME/.apptainer/images/$APPS_VERSION
+        echo -e "\e[32mNew version is ready.\e[0m ($HOME/.apptainer/images/$APPS_VERSION)"
         unset IMAGE_PATH_LOCAL
-        export IMAGE_PATH_LOCAL="$HOME/.singularity/images/$APPS_VERSION"
-        [ -f $HOME/.singularity/images/$LOCAL_VERSION ] && rm $HOME/.singularity/images/$LOCAL_VERSION 
+        export IMAGE_PATH_LOCAL="$HOME/.apptainer/images/$APPS_VERSION"
+        [ -f $HOME/.apptainer/images/$LOCAL_VERSION ] && rm $HOME/.apptainer/images/$LOCAL_VERSION 
     else
 	echo "Exiting..."
     fi
-- 
GitLab