summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkj_sh6042026-05-19 20:59:16 -0400
committerkj_sh6042026-05-19 20:59:16 -0400
commit62ae076204efaa26b50ad40742f75a4425747910 (patch)
tree6b4c8f4d47db799a5541c9c0438abe7a8fde5949
parent7e033c9d81a3513c40db9786cb61715708b8d61d (diff)
refactor: jupyter
-rwxr-xr-xjupyter27
1 files changed, 27 insertions, 0 deletions
diff --git a/jupyter b/jupyter
new file mode 100755
index 0000000..de603e9
--- /dev/null
+++ b/jupyter
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+APPIMAGE_DIR="/opt/jupyterlab-appimage"
+
+# - find the AppImage; fail clearly if missing or ambiguous
+_match="$(find "$APPIMAGE_DIR" -maxdepth 1 -name 'jupyterlab-*.AppImage' 2>/dev/null)"
+_count="$(printf '%s\n' "$_match" | grep -c 'AppImage' 2>/dev/null || echo 0)"
+
+if [ "$_count" -eq 0 ]; then
+ printf 'error: no jupyterlab AppImage found in %s\n' "$APPIMAGE_DIR" >&2
+ exit 1
+fi
+
+if [ "$_count" -gt 1 ]; then
+ printf 'error: multiple AppImages found in %s - keep only one:\n' "$APPIMAGE_DIR" >&2
+ printf '%s\n' "$_match" >&2
+ exit 1
+fi
+
+APPIMAGE="$_match"
+export APPIMAGE_EXTRACT_AND_RUN=1
+# - default to 'lab' when no subcommand is given; otherwise pass args as-is
+if [ "$#" -eq 0 ]; then
+ exec "$APPIMAGE" lab
+else
+ exec "$APPIMAGE" "$@"
+fi