File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ install-tensorflow:
3636tensorflow-gpu : install-tensorflow-gpu
3737install-tensorflow-gpu :
3838 /scripts/install-tensorflow.sh gpu
39+ codex :
40+ /scripts/install-codex.sh
3941davfs : install-davfs
4042install-davfs :
4143 /scripts/install-davfs.sh
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Installs the Codex CLI coding agent on Linux.
4+ # bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-codex.sh)
5+
6+ set -Eeuo pipefail
7+
8+ echo " Installing Codex CLI..."
9+
10+ # Ensure npm exists
11+ if ! command -v npm > /dev/null 2>&1 ; then
12+ echo " ERROR: npm not found. Please install Node.js (npm) and re-run." >&2
13+ exit 1
14+ fi
15+
16+ # Create CODEX_HOME if set (and not '/')
17+ if [ -n " ${CODEX_HOME:- } " ]; then
18+ if [ " ${CODEX_HOME} " = " /" ]; then
19+ echo " ERROR: refusing to use CODEX_HOME='/'" >&2
20+ exit 2
21+ fi
22+ install -d -m 700 -- " ${CODEX_HOME} "
23+ fi
24+
25+ # Choose sudo only if available and not already root
26+ SUDO=" "
27+ if command -v sudo > /dev/null 2>&1 && [ " $( id -u) " -ne 0 ]; then
28+ SUDO=" sudo"
29+ fi
30+
31+ # Some npm versions don’t support --location=global; detect and adapt
32+ if npm help install 2> /dev/null | grep -q -- ' --location' ; then
33+ NPM_GLOBAL_OPTS=(install -g --location=global --no-fund --no-audit)
34+ else
35+ NPM_GLOBAL_OPTS=(install -g --no-fund --no-audit)
36+ fi
37+
38+ # Install / update Codex CLI
39+ $SUDO npm " ${NPM_GLOBAL_OPTS[@]} " " @openai/codex@latest"
40+
41+ # Show result
42+ if command -v codex > /dev/null 2>&1 ; then
43+ echo " Codex installed at: $( command -v codex) "
44+ codex --version || true
45+ fi
46+
47+ echo " Done."
You can’t perform that action at this time.
0 commit comments