Skip to content

Commit 3a15491

Browse files
chapterjasonclaude
andcommitted
Add codex installer and scope VERSION env var to tool name in all installers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6560eb5 commit 3a15491

12 files changed

Lines changed: 62 additions & 10 deletions

File tree

scripts/cmake/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://cmake.org/
44
set -e
55

6-
CMAKE_VERSION="${VERSION:-latest}"
6+
CMAKE_VERSION="${CMAKE_VERSION:-latest}"
77

88
if [ "$CMAKE_VERSION" = "latest" ]; then
99
CMAKE_VERSION="$(curl -fsSL https://api.github.com/repos/Kitware/CMake/releases/latest \

scripts/codex/install.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
# codex installer. Runs as the workspace user — npm install -g goes into
3+
# the user's own nvm prefix ($HOME/.nvm/versions/node/<v>/bin).
4+
# https://github.com/openai/codex
5+
set -e
6+
7+
CODEX_VERSION_OPT="${CODEX_VERSION:-latest}"
8+
9+
# Activate nvm so `npm` resolves against the user's default Node.
10+
export NVM_DIR="$HOME/.nvm"
11+
if [ -s "$NVM_DIR/nvm.sh" ]; then
12+
# shellcheck disable=SC1091
13+
. "$NVM_DIR/nvm.sh"
14+
nvm use default >/dev/null
15+
fi
16+
17+
if ! command -v npm >/dev/null 2>&1; then
18+
echo "codex: npm not on PATH. scripts/nvm/install.sh must run before scripts/codex/install.sh." >&2
19+
exit 1
20+
fi
21+
22+
# Resolve target version. `latest` → newest tag via GitHub API.
23+
if [ "$CODEX_VERSION_OPT" = "latest" ]; then
24+
CODEX_VERSION="$(curl -fsSL https://api.github.com/repos/openai/codex/releases/latest | jq -r .tag_name)"
25+
else
26+
CODEX_VERSION="$CODEX_VERSION_OPT"
27+
fi
28+
CODEX_VERSION="${CODEX_VERSION#rust-v}"
29+
if [ -z "$CODEX_VERSION" ] || [ "$CODEX_VERSION" = "null" ]; then
30+
echo "codex: failed to resolve release version (got '$CODEX_VERSION_OPT')." >&2
31+
exit 1
32+
fi
33+
34+
npm install -g "@openai/codex@${CODEX_VERSION}"
35+
36+
if ! command -v codex >/dev/null 2>&1; then
37+
echo "codex: binary not on PATH after npm install." >&2
38+
exit 1
39+
fi
40+
41+
# Declare the HOME paths Codex needs persisted. The home-persist
42+
# resolver reads every /etc/home-persist.d/*.json at workspace start and
43+
# symlinks these into /mnt/home-persist. /etc/home-persist.d is root-owned.
44+
sudo mkdir -p /etc/home-persist.d
45+
sudo tee /etc/home-persist.d/codex.json >/dev/null <<'EOF'
46+
{
47+
"source": "codex",
48+
"paths": [".codex/"]
49+
}
50+
EOF

scripts/composer/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# https://getcomposer.org/
66
set -e
77

8-
COMPOSER_VERSION="${VERSION:-}"
8+
COMPOSER_VERSION="${COMPOSER_VERSION:-}"
99
INSTALL_DIR="$HOME/.local/bin"
1010
mkdir -p "$INSTALL_DIR"
1111

scripts/frankenphp/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# https://github.com/dunglas/frankenphp
66
set -e
77

8-
FP_VERSION_OPT="${VERSION:-latest}"
8+
FP_VERSION_OPT="${FRANKENPHP_VERSION:-latest}"
99
INSTALL_DIR="$HOME/.local/bin"
1010
mkdir -p "$INSTALL_DIR"
1111

scripts/icu/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# https://github.com/unicode-org/icu
1010
set -euo pipefail
1111

12-
ICU_VERSION="${VERSION:-latest}"
12+
ICU_VERSION="${ICU_VERSION:-latest}"
1313

1414
if [ "$ICU_VERSION" = "latest" ]; then
1515
TAG="$(curl -fsSL https://api.github.com/repos/unicode-org/icu/releases/latest \

scripts/llvm/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://apt.llvm.org/
44
set -e
55

6-
LLVM_VERSION="${VERSION:-22}"
6+
LLVM_VERSION="${LLVM_VERSION:-22}"
77
LLVM_ALL="${ALL:-true}"
88

99
TMPDIR="$(mktemp -d)"

scripts/nvm/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# https://github.com/nvm-sh/nvm
55
set -e
66

7-
NVM_VERSION="${VERSION:-0.40.4}"
7+
NVM_VERSION="${NVM_VERSION:-0.40.4}"
88
NODE_VERSION="${NODE:-lts}"
99

1010
curl -fsSL "https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh" \

scripts/php/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# https://deb.sury.org/
88
set -e
99

10-
PHP_DEFAULT_VERSION="${VERSION:-8.5}"
10+
PHP_DEFAULT_VERSION="${PHP_VERSION:-8.5}"
1111
# Extensions installed for every version (Sury naming, prefixed at use-site).
1212
# `common` pulls pdo/phar; `mysql`/`pgsql`/`sqlite3` include their pdo drivers.
1313
PHP_EXT_SET="cli common curl mbstring xml intl zip gd bcmath opcache apcu mysql pgsql sqlite3 redis xdebug"

scripts/sccache/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://github.com/mozilla/sccache
44
set -e
55

6-
SCCACHE_VERSION="${VERSION:-latest}"
6+
SCCACHE_VERSION="${SCCACHE_VERSION:-latest}"
77

88
if [ "$SCCACHE_VERSION" = "latest" ]; then
99
SCCACHE_VERSION="$(curl -fsSL https://api.github.com/repos/mozilla/sccache/releases/latest \

scripts/symfony-cli/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# https://github.com/symfony-cli/symfony-cli
55
set -e
66

7-
SF_VERSION_OPT="${VERSION:-latest}"
7+
SF_VERSION_OPT="${SYMFONY_VERSION:-latest}"
88
INSTALL_DIR="$HOME/.local/bin"
99
mkdir -p "$INSTALL_DIR"
1010

0 commit comments

Comments
 (0)