From bfe9510b9e215152a0f8778c2ec6965b9a9d9991 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= <valtri@civ.zcu.cz>
Date: Fri, 7 Jun 2024 12:43:24 +0000
Subject: [PATCH] Fix ownCloud home directory mounting - cleaner way

---
 cesnet-central/deployments/fullhub.yaml | 33 +++++++++++++++++++------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/cesnet-central/deployments/fullhub.yaml b/cesnet-central/deployments/fullhub.yaml
index 08a4cea..0b925a6 100644
--- a/cesnet-central/deployments/fullhub.yaml
+++ b/cesnet-central/deployments/fullhub.yaml
@@ -79,14 +79,31 @@ singleuser:
         args:
           - "--CondaKernelSpecManager.env_filter='/opt/conda$'"
         image: "valtri/single-user:jupyter-4e-collab"
-  #
-  # Dirty hack to make remote mount working properly:
-  #
-  # 1) wait for webdav sidecar image to kick in
-  # 2) change directory to the mounted version of itself
-  # 3) launch notebook server
-  #
-  cmd: [ "/bin/sh", "-c", "i=0; while ! grep '^webdav-fs: /home/jovyan ' /proc/mounts && test $i -lt 30; do echo 'Waiting for ownClound mount...'; sleep 0.5; i=$((i+1)); done; cd .; jupyterhub-singleuser" ]
+  cmd: jupyterhub-singleuser-webdav-wrapper
+  extraFiles:
+    wait-owncloud.sh:
+      mode: 0755
+      mountPath: /usr/local/bin/jupyterhub-singleuser-webdav-wrapper
+      stringData: |-
+        #! /bin/sh
+
+        #
+        # Dirty hack to make remote mount on home directory working properly:
+        #
+        # 1) wait for webdav sidecar image to kick in
+        # 2) change directory to the mounted version of itself
+        # 3) launch notebook server
+        #
+        i=0
+        while ! grep '^webdav-fs: /home/jovyan ' /proc/mounts && test $i -lt 30; do
+          echo 'Waiting for ownClound mount...'
+          sleep 0.5
+          i=$((i+1))
+        done
+
+        cd .
+
+        exec jupyterhub-singleuser "$@"
 
 hub:
   services:
-- 
GitLab