-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-codex-linux.sh
More file actions
executable file
·37 lines (34 loc) · 1.47 KB
/
Copy pathrun-codex-linux.sh
File metadata and controls
executable file
·37 lines (34 loc) · 1.47 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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_DIR="$ROOT_DIR/app"
ELECTRON_BIN="${ELECTRON_BIN:-$ROOT_DIR/node_modules/.bin/electron}"
export ELECTRON_RENDERER_URL="${ELECTRON_RENDERER_URL:-file://$APP_DIR/webview/index.html}"
export ELECTRON_IS_DEV="${ELECTRON_IS_DEV:-0}"
export BUILD_FLAVOR="${BUILD_FLAVOR:-prod}"
export NODE_ENV="${NODE_ENV:-production}"
if [[ -z "${CODEX_CLI_PATH:-}" ]]; then
CODEX_CLI_PATH="$(command -v codex || true)"
if [[ -n "$CODEX_CLI_PATH" ]]; then
export CODEX_CLI_PATH
else
# Common nvm layout fallback (pick newest installed).
if [[ -d "$HOME/.nvm/versions/node" ]]; then
CODEX_CLI_PATH="$(ls -1 "$HOME/.nvm/versions/node"/*/bin/codex 2>/dev/null | sort -V | tail -n 1 || true)"
if [[ -n "$CODEX_CLI_PATH" ]]; then
export CODEX_CLI_PATH
fi
fi
fi
fi
if [[ ! -x "$ELECTRON_BIN" ]]; then
echo "Electron not found at $ELECTRON_BIN"
# NOTE: This repo was developed/tested against a DMG shipping Electron 40.
# If your DMG uses a different version, run setup.sh first — it detects the
# correct version automatically from app/package.json.
echo "Run ./setup.sh first, or install manually: npm install --no-save electron@<VERSION>"
exit 1
fi
echo "WARNING: Running Electron with --no-sandbox (reduced process isolation)." >&2
echo " If your system supports it, consider removing --no-sandbox." >&2
exec "$ELECTRON_BIN" "$APP_DIR" --no-sandbox "$@"