Add install.sh with an app-menu launcher
install.sh builds the image (run.sh --build-only) and adds a "Claude RE Workstation" desktop entry that starts this checkout's run.sh, with Claude Desktop's icons taken from the image under their own name. --uninstall removes the launcher and icons again. run.sh gains --build-only, which needs no display, and shows errors in a zenity dialog when it has no terminal, as when started from the menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
# Also starts the REA MCP server in a second, isolated container and stops it
|
||||
# when Claude Desktop's container ends.
|
||||
#
|
||||
# Usage: ./run.sh [--build] [--check-only] [--workspace DIR]
|
||||
# Usage: ./run.sh [--build] [--build-only] [--check-only] [--workspace DIR]
|
||||
# --build rebuild the image even if it exists
|
||||
# --build-only (re)build the image and exit
|
||||
# --check-only run the display check and exit without starting Claude
|
||||
# --workspace DIR share DIR without asking (also: WORKSPACE=DIR)
|
||||
|
||||
@@ -27,23 +28,50 @@ last_workspace_file="$state_dir/last_workspace"
|
||||
|
||||
build=0
|
||||
check_only=0
|
||||
build_only=0
|
||||
while (( $# )); do
|
||||
case "$1" in
|
||||
--build) build=1 ;;
|
||||
--build-only) build=1 build_only=1 ;;
|
||||
--check-only) check_only=1 ;;
|
||||
--workspace) [[ $# -ge 2 ]] || { echo "--workspace needs a directory" >&2; exit 2; }
|
||||
WORKSPACE="$2"; shift ;;
|
||||
--workspace=*) WORKSPACE="${1#*=}" ;;
|
||||
-h|--help) sed -n '2,12p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
-h|--help) sed -n '2,13p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
*) echo "Unknown argument: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
die() { echo "error: $*" >&2; exit 1; }
|
||||
# Started from the app menu (install.sh) there is no terminal to read
|
||||
# errors in, so they are also shown in a dialog.
|
||||
die() {
|
||||
echo "error: $*" >&2
|
||||
if [[ ! -t 2 ]] && command -v zenity >/dev/null; then
|
||||
zenity --error --no-wrap --title="Claude RE workstation" --text="$*" 2>/dev/null || true
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
info() { echo "==> $*"; }
|
||||
|
||||
command -v "$RUNTIME" >/dev/null || die "'$RUNTIME' not found (set RUNTIME=podman to use podman)"
|
||||
|
||||
# --- Image build -------------------------------------------------------------
|
||||
ensure_image() {
|
||||
if (( build )) || ! "$RUNTIME" image inspect "$IMAGE" >/dev/null 2>&1; then
|
||||
info "Building $IMAGE"
|
||||
"$RUNTIME" build \
|
||||
--build-arg USER_UID="$(id -u)" \
|
||||
--build-arg USER_GID="$(id -g)" \
|
||||
-t "$IMAGE" "$script_dir"
|
||||
fi
|
||||
}
|
||||
if (( build_only )); then
|
||||
ensure_image
|
||||
info "Built $IMAGE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
command -v xauth >/dev/null || die "xauth not found on the host (dnf install xorg-x11-xauth)"
|
||||
|
||||
# --- Display -----------------------------------------------------------------
|
||||
@@ -69,13 +97,7 @@ xauth nlist "$DISPLAY" | sed -e 's/^..../ffff/' | xauth -f "$xauth_file" nmerge
|
||||
chmod 600 "$xauth_file"
|
||||
|
||||
# --- Image -------------------------------------------------------------------
|
||||
if (( build )) || ! "$RUNTIME" image inspect "$IMAGE" >/dev/null 2>&1; then
|
||||
info "Building $IMAGE"
|
||||
"$RUNTIME" build \
|
||||
--build-arg USER_UID="$(id -u)" \
|
||||
--build-arg USER_GID="$(id -g)" \
|
||||
-t "$IMAGE" "$script_dir"
|
||||
fi
|
||||
ensure_image
|
||||
|
||||
# label=disable: the X socket and cookie are host files that SELinux would
|
||||
# otherwise block, and relabeling /tmp/.X11-unix with :z would break the host.
|
||||
|
||||
Reference in New Issue
Block a user