mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-06 13:12:31 +02:00
Fix persistent Claude terminal shell startup
This commit is contained in:
@@ -1,15 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
export HOME="${HOME:-/data/data}"
|
if [ -z "${HOME:-}" ]; then
|
||||||
|
echo "Claude terminal: HOME is not initialized." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SHELL="/bin/bash"
|
||||||
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
||||||
|
|
||||||
workspace="${CLAUDE_TERMINAL_WORKSPACE:-${HOME}/workspace}"
|
workspace="${CLAUDE_TERMINAL_WORKSPACE:-${HOME}/workspace}"
|
||||||
session_name="${CLAUDE_TMUX_SESSION:-claude}"
|
session_name="${CLAUDE_TMUX_SESSION:-claude}"
|
||||||
|
|
||||||
mkdir -p "$workspace"
|
if [ ! -d "$workspace" ]; then
|
||||||
cd "$workspace"
|
echo "Claude terminal: workspace does not exist: $workspace" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd -- "$workspace"
|
||||||
|
|
||||||
# Reattach every browser connection to the same terminal session. Closing the browser detaches
|
# Reattach every browser connection to the same terminal session. Closing the browser detaches
|
||||||
# the client but leaves Claude Code and other commands running inside tmux.
|
# the client but leaves Claude Code and other commands running inside tmux.
|
||||||
exec tmux new-session -A -s "$session_name"
|
exec tmux new-session -A -s "$session_name" -c "$workspace"
|
||||||
|
|||||||
Reference in New Issue
Block a user