diff --git a/Packaging/Files/otbenv.profile b/Packaging/Files/otbenv.profile
index c40c49a2c729fafc400b56bf56edaaa7b8f4f68d..bc934b99dff63ca0537d706a9978b0f93ee3e1ce 100644
--- a/Packaging/Files/otbenv.profile
+++ b/Packaging/Files/otbenv.profile
@@ -42,7 +42,7 @@ OS="$(lsb_release -is)"
 # path may differ
 if [ -n "${BASH}" ]; then
   # dirname does not exists on RH-based OS
-  if [ $OS = "RedHatEnterprise" ] || [ $OS = "Fedora" ] || [ $OS = "RockyLinux" ]; then
+  if [ "$OS" = "RedHatEnterprise" ] || [ "$OS" = "Fedora" ] || [ "$OS" = "RockyLinux" ]; then
     OTB_INSTALL_DIR="$(realpath $(dirname "${BASH_SOURCE[0]}"))"
   elif [ -n "${BASH}" ]; then
     OTB_INSTALL_DIR="$( dirname -- "$( readlink -f -- "${BASH_SOURCE[0]}"; )"; )"
@@ -51,7 +51,7 @@ else
   # non-bash shell
   OTB_INSTALL_DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
 fi
-CMAKE_PREFIX_PATH=$OTB_INSTALL_DIR
+CMAKE_PREFIX_PATH="$OTB_INSTALL_DIR"
 export CMAKE_PREFIX_PATH
 
 # check and set OTB_APPLICATION_PATH
@@ -62,7 +62,7 @@ PATH=$(cat_path "$OTB_INSTALL_DIR/bin" "$PATH")
 
 # export PYTHONPATH to import otbApplication.py
 PYTHONPATH=$(cat_path "$OTB_INSTALL_DIR/lib/otb/python" "$PYTHONPATH")
-if [ $OS = "RedHatEnterprise" ] || [ $OS = "Fedora" ] || [ $OS = "RockyLinux" ]; then
+if [ "$OS" = "RedHatEnterprise" ] || [ "$OS" = "Fedora" ] || [ "$OS" = "RockyLinux" ]; then
   PYTHONPATH=$(cat_path "$OTB_INSTALL_DIR/lib/python3.8/site-packages" "$PYTHONPATH")
 else
   PYTHONPATH=$(cat_path "$OTB_INSTALL_DIR/lib/python3/dist-packages" "$PYTHONPATH")
@@ -76,7 +76,7 @@ GDAL_DATA="$OTB_INSTALL_DIR/share/gdal"
 
 PROJ_LIB="$OTB_INSTALL_DIR/share/proj"
 
-export GDAL_DRIVER_PATH=disable
+export GDAL_DRIVER_PATH="disable"
 
 export LD_LIBRARY_PATH="$OTB_INSTALL_DIR/lib:$LD_LIBRARY_PATH"
 
diff --git a/Packaging/Files/post_install.sh.in b/Packaging/Files/post_install.sh.in
index e14909d8fcd2197ffcc1535db38a4f91de606cce..7734a39a2da4b00d3197142ead8613a0144d869b 100644
--- a/Packaging/Files/post_install.sh.in
+++ b/Packaging/Files/post_install.sh.in
@@ -33,25 +33,28 @@ sed -i "s/\/builds\/otb\/xdk/\$OTB_INSTALL_DIR/g" "$OTB_INSTALL_DIR"/bin/gdal-co
 sed -i "s/\/builds\/otb\/xdk/\$OTB_INSTALL_DIR/g" "$OTB_INSTALL_DIR"/bin/curl-config
 sh "$OTB_INSTALL_DIR"/tools/sanitize_rpath.sh
 
-pyversion="$(python3 -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]*\).*/\1\2/')"
+concatpyversion="$(python3 -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]*\).*/\1\2/')"
 ostype="$(lsb_release -is)"
-# Recompile OTB Python bindings
-if [ "$pyversion" -ne "310" ] && [ $ostype != "RedHatEnterprise" ] ; then
+# Recompile OTB Python bindings. By default on non RHEL OS, the packaged
+# bindings are compiled for version 3.10
+if [ "$concatpyversion" -ne "310" ] && [ $ostype != "RedHatEnterprise" ] ; then
     sh "$OTB_INSTALL_DIR"/recompile_bindings.sh
 fi
 # Check python version, if python 3.12 (ubuntu 24 and debian > 12) download and extract the gdal bindings for python 3.12
 # In case your install is from compiled code, the gdal bindings will be already there in the installation
-python_distpackage_path="$OTB_INSTALL_DIR/lib/python3/dist-packages/osgeo/"
-gdal_python_found="$(find $python_distpackage_path -name "*$pyversion-x86_64-linux*")"
+# Note that the install path differs from RHEL to debian based OS. To handle it,
+# check before the folder name (always prefixed of python3)
+osgeo_pkg_path=$(find "$OTB_INSTALL_DIR/lib" -mindepth 3 -maxdepth 3 -type d -name "osgeo")
+gdal_python_found="$(find $osgeo_pkg_path -name "*$concatpyversion-x86_64-linux*")"
 if [ -z "$gdal_python_found" ]; then
-    echo "***** Python $pyversion detected, downloading gdal bindings compiled for this Python version *****"
-    HTTP_STATUS=$(curl -s -o "$OTB_INSTALL_DIR"/tools/gdal-py$pyversion.tar.gz -w "%{response_code}\n" https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-$OTB_SHORT_VERSION-GDAL-bindings-py$pyversion.tar.gz)
+    echo "***** Python $concatpyversion detected, downloading gdal bindings compiled for this Python version *****"
+    HTTP_STATUS=$(curl -s -o "$OTB_INSTALL_DIR"/tools/gdal-py$concatpyversion.tar.gz -w "%{response_code}\n" https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-$OTB_SHORT_VERSION-GDAL-bindings-py$concatpyversion.tar.gz)
     if [ $HTTP_STATUS -eq 200 ]; then
-        tar -xf "$OTB_INSTALL_DIR"/tools/gdal-py$pyversion.tar.gz -C $python_distpackage_path
-        rm "$OTB_INSTALL_DIR"/tools/gdal-py$pyversion.tar.gz
-        echo "***** GDAL bindings for python $pyversion successfully installed *****"
+        tar -xf "$OTB_INSTALL_DIR"/tools/gdal-py$concatpyversion.tar.gz -C $python_distpackage_path
+        rm "$OTB_INSTALL_DIR"/tools/gdal-py$concatpyversion.tar.gz
+        echo "***** GDAL bindings for python $concatpyversion successfully installed *****"
     else
-        echo "Can not find GDAL bindings at https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-$OTB_SHORT_VERSION-GDAL-bindings-py$pyversion.tar.gz"
+        echo "Can not find GDAL bindings at https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-$OTB_SHORT_VERSION-GDAL-bindings-py$concatpyversion.tar.gz"
         return -1
     fi
 fi