-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathctx
More file actions
executable file
·57 lines (48 loc) · 1.87 KB
/
ctx
File metadata and controls
executable file
·57 lines (48 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
DOCKER_REQUESTED=false
if [[ "${1:-}" == "--docker" ]]; then
DOCKER_REQUESTED=true
shift
fi
DOCKER_COMPOSE_CMD=(docker compose)
if ! docker compose version >/dev/null 2>&1 && command -v docker-compose >/dev/null 2>&1; then
DOCKER_COMPOSE_CMD=(docker-compose)
fi
# FIX: Expects 'coretex' image to match docker-compose.yml
if command -v docker &> /dev/null && docker image inspect coretex &> /dev/null; then
export HOST_UID=$(id -u)
export HOST_GID=$(id -g)
# Natively build fallback directory to preserve host user ownership boundaries
export CORETEX_WORKSPACE_MOUNT="$(pwd)/Workspace"
mkdir -p "$CORETEX_WORKSPACE_MOUNT"
ARGS=()
for arg in "$@"; do
# FIX: Track absolute file paths accurately without blinding execution parameters
if [[ -e "$arg" ]]; then
ABS_PATH="$(cd "$(dirname "$arg")" && pwd)"
if [[ -d "$arg" ]]; then
export CORETEX_WORKSPACE_MOUNT="$(cd "$arg" && pwd)"
ARGS+=("/workspace")
else
export CORETEX_WORKSPACE_MOUNT="$ABS_PATH"
ARGS+=("/workspace/$(basename "$arg")")
fi
else
ARGS+=("$arg")
fi
done
exec "${DOCKER_COMPOSE_CMD[@]}" run --rm coretex "${ARGS[@]}"
fi
if [ "$DOCKER_REQUESTED" = true ]; then
echo -e "\033[1;31m[!] Docker runtime requested, but the 'coretex' image is not built.\033[0m"
echo -e "Run \033[1;36m./setup.sh --docker\033[0m first, or build with your Compose installation."
exit 1
fi
if [ ! -f ./.venv/bin/python ]; then
echo -e "\033[1;31m[!] CoreTex Environment Core Not Found.\033[0m"
echo -e "Please run \033[1;36m./setup.sh\033[0m to configure your isolated container or local venv architecture."
exit 1
fi
exec ./.venv/bin/python -m System.cli "$@"