Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ then clones this repo to `~/.setup` and symlinks the Claude config into
`~/.claude`. It works on macOS (Homebrew) and Linux (apt/dnf/apk), and is safe
to re-run — anything already present is skipped.

Codex CLI installs without interactive prompts. On Linux, the bootstrap sets
`CODEX_NON_INTERACTIVE=1` for the Codex installer, which also skips launching
Codex after installation. Run `codex` when you are ready to sign in.

Each install is verified twice: the expected command must be on `PATH`, and the
CLIs this bootstrap exists to install must actually execute (`assert_runs`
invokes each one's version command, since a truncated download or a
Expand Down
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ install_codex() {
if [ "$PM" = "brew" ]; then
brew install --cask codex || { warn "failed to install Codex CLI"; record_failure codex; }
else
curl -fsSL https://chatgpt.com/codex/install.sh | sh || { warn "failed to install Codex CLI"; record_failure codex; }
# Keep bootstrap unattended, including when the installer can read /dev/tty.
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh || { warn "failed to install Codex CLI"; record_failure codex; }
add_path "$HOME/.local/bin"
fi
assert_installed "Codex CLI" codex
Expand Down
31 changes: 31 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,37 @@ source ./install.sh
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT

# The downloaded Codex installer must receive noninteractive mode. Setting it
# on curl instead of sh would still leave a terminal-attached bootstrap blocked.
mkdir -p "$scratch/codex-install-bin"
(
unset CODEX_NON_INTERACTIVE
export CODEX_TEST_BIN="$scratch/codex-install-bin/codex"
export PATH="$scratch/codex-install-bin:$PATH"
PM=apt
FAILED=""
have() { [ "$1" = codex ] && [ -x "$CODEX_TEST_BIN" ]; }
add_path() { :; }
curl() {
cat <<'EOF'
set -eu
[ "${CODEX_NON_INTERACTIVE:-0}" = 1 ] || exit 1
printf '#!/bin/sh\nexit 0\n' > "$CODEX_TEST_BIN"
chmod +x "$CODEX_TEST_BIN"
EOF
}
install_codex
[ -x "$CODEX_TEST_BIN" ] || exit 1
[ -z "$FAILED" ] || exit 1
[ "${CODEX_NON_INTERACTIVE-unset}" = unset ] || exit 1
curl() { echo 'unexpected installer download on re-run' >&2; exit 1; }
install_codex
[ -z "$FAILED" ] || exit 1
) || {
echo "FAIL: Codex installation was not noninteractive or safe to re-run" >&2
exit 1
}

# assert_installed must fail for a missing command, and summary must then
# return nonzero rather than reporting a clean bootstrap.
FAILED=""
Expand Down
Loading