File size: 891 Bytes
21ff762
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
# Compatibility wrapper for source checkouts.
#
# The supported installer is ctx-init. This script exists only for users who
# still run `bash install.sh` from a clone; it delegates to the packaged
# bootstrap module instead of calling legacy flat scripts.

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CTX_DIR="$SCRIPT_DIR"

if [[ "${1:-}" == "--ctx-dir" ]]; then
  if [[ -z "${2:-}" ]]; then
    echo "install.sh: --ctx-dir requires a path" >&2
    exit 2
  fi
  CTX_DIR="$2"
  shift 2
elif [[ -n "${1:-}" && "${1:-}" != --* ]]; then
  CTX_DIR="$1"
  shift
fi

PYTHON="${PYTHON:-python3}"
if ! command -v "$PYTHON" >/dev/null 2>&1; then
  PYTHON="python"
fi

PYTHONPATH_SEP="$("$PYTHON" - <<'PY'
import os
print(os.pathsep)
PY
)"
export PYTHONPATH="$CTX_DIR/src${PYTHONPATH:+$PYTHONPATH_SEP$PYTHONPATH}"
exec "$PYTHON" -m ctx_init "$@"