@@ -43,14 +43,14 @@ def get_proxy_version(config, app_env=None):
4343
4444def wrap_command_with_proxy_installer (cmd_list , proxy_version ):
4545 """
46- Wraps a command list in a bash script that installs jhub-app-proxy.
46+ Wraps a command list in a shell script that installs jhub-app-proxy.
4747
4848 Args:
4949 cmd_list: List of command arguments (e.g., ['jhub-app-proxy', '--authtype=oauth', ...])
5050 proxy_version: Version of jhub-app-proxy to install
5151
5252 Returns:
53- List with bash wrapper: ['/bin/bash ', '-c', '<script>']
53+ List with shell wrapper: ['/bin/sh ', '-c', '<script>']
5454 """
5555 # Convert command list to a shell-escaped string
5656 cmd_str = ' ' .join (shlex .quote (str (arg )) for arg in cmd_list )
@@ -61,15 +61,31 @@ def wrap_command_with_proxy_installer(cmd_list, proxy_version):
6161
6262# Install jhub-app-proxy (overrides if already present)
6363echo "Installing jhub-app-proxy version { proxy_version } ..."
64- echo "Running: curl -fsSL { JHUB_APP_PROXY_INSTALL_URL } | bash -s -- -v { proxy_version } -d /tmp/.local/bin"
65- curl -fsSL { JHUB_APP_PROXY_INSTALL_URL } | bash -s -- -v { proxy_version } -d /tmp/.local/bin
64+
65+ # Try curl, wget, then Python as fallbacks
66+ if command -v curl >/dev/null 2>&1; then
67+ echo "Using curl to download installer..."
68+ curl -fsSL { JHUB_APP_PROXY_INSTALL_URL } | sh -s -- -v { proxy_version } -d /tmp/.local/bin
69+ elif command -v wget >/dev/null 2>&1; then
70+ echo "Using wget to download installer..."
71+ wget -qO- { JHUB_APP_PROXY_INSTALL_URL } | sh -s -- -v { proxy_version } -d /tmp/.local/bin
72+ elif command -v python3 >/dev/null 2>&1; then
73+ echo "Using python3 to download installer..."
74+ python3 -c "import urllib.request; import sys; response = urllib.request.urlopen('{ JHUB_APP_PROXY_INSTALL_URL } '); sys.stdout.buffer.write(response.read())" | sh -s -- -v { proxy_version } -d /tmp/.local/bin
75+ elif command -v python >/dev/null 2>&1; then
76+ echo "Using python to download installer..."
77+ python -c "import urllib.request; import sys; response = urllib.request.urlopen('{ JHUB_APP_PROXY_INSTALL_URL } '); sys.stdout.buffer.write(response.read())" | sh -s -- -v { proxy_version } -d /tmp/.local/bin
78+ else
79+ echo "Error: No download tool found (tried: curl, wget, python3, python). Cannot download jhub-app-proxy installer." >&2
80+ exit 1
81+ fi
6682
6783# Execute the original command
6884echo "Running command: { cmd_str } "
6985exec { cmd_str }
7086''' .strip ()
7187
72- return ['/bin/bash ' , '-c' , install_script ]
88+ return ['/bin/sh ' , '-c' , install_script ]
7389
7490
7591def subclass_spawner (base_spawner ):
0 commit comments