diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4454a34..deffe64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,6 +91,8 @@ jobs: test ! -e "$HOME/.local/share/cxcc" - name: Install pinned cxcc and verify repeat apply + env: + INSTALL_CXCC: "1" run: | profiles_before="$(sha256sum "$HOME/.ai-env/profiles.json" | awk '{print $1}')" chezmoi apply --source "$GITHUB_WORKSPACE" @@ -104,6 +106,7 @@ jobs: - name: Run full smoke check env: DOTFILES_SOURCE_DIR: ${{ github.workspace }} + INSTALL_CXCC: "1" run: bash ./test/smoke.sh macos: @@ -205,6 +208,8 @@ jobs: } - name: Install pinned cxcc and verify repeat apply + env: + INSTALL_CXCC: "1" run: | $profilesPath = Join-Path $HOME ".ai-env\profiles.json" $currentPath = Join-Path $HOME ".local\share\cxcc\current.json" @@ -218,4 +223,6 @@ jobs: if ($currentBefore -cne $currentAfter) { throw "Repeated cxcc apply changed current.json." } - name: Run full Windows smoke check + env: + INSTALL_CXCC: "1" run: ./test/windows-full-smoke.ps1 -SourceDir "$PWD" diff --git a/README.ja.md b/README.ja.md index d99ad09..d0e5333 100644 --- a/README.ja.md +++ b/README.ja.md @@ -70,7 +70,7 @@ INSTALL_CLAUDE=1 bash ./bootstrap.sh INSTALL_NODE=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FASTFETCH=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_MODERN_CLI=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles -INSTALL_CXCC=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles +INSTALL_CXCC=1 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FONTS=0 bash ./bootstrap.sh INSTALL_WINDOWS_FONTS_FROM_WSL=0 bash ./bootstrap.sh DOTFILES_USE_SUDO=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles @@ -92,7 +92,8 @@ sudo にパスワードが必要な場合は確認し、デフォルトでは使 - 互換性のある fastfetch を `~/.local/bin` へ - システムパッケージが有効な場合は Node.js と npm - 現在ユーザーの font directory へ 0xProto Nerd Font -- 固定バージョンの cxcc と、`cx`、`cc`、`mcp` を読み込む PowerShell/Zsh hook +- 選択した場合、固定バージョンの cxcc と `cx`、`cc`、`mcp` を読み込む + PowerShell/Zsh hook zsh がなく build tools がある場合は、zsh を `~/.local` にビルドします。 古い Linux では fastfetch の polyfilled binary を優先し、適合するものがなければ @@ -121,7 +122,7 @@ flag が互換ではない `rg`、`fd`、`sd`、`jq`、`yq`、`xh`、`delta` は ## CX/CC AI Profile ツール -dotfiles は固定バージョンの cxcc をインストールし、その軽量 shell function で +dotfiles は固定バージョンの cxcc を選択してインストールでき、その軽量 shell function で Codex と Claude Code のローカル状態を切り替えます。CLI 自体は起動しません。 コマンド実装と cross-platform test は cxcc が、version pin、install hook、loader 接続、default user config はこの repo が管理します。 @@ -160,9 +161,10 @@ Payload: ~/.local/share/cxcc/versions/v0.1.0/ ``` release tag、immutable commit、installer digest、platform artifact digest は -`.chezmoidata.toml` にまとめてあります。対応する pin をすべて更新して -`chezmoi apply` を実行すると upgrade できます。`INSTALL_CXCC=0` で install を -skip でき、変数を外した次回 apply で通常動作に戻ります。 +`.chezmoidata.toml` にまとめてあります。cxcc はデフォルトではインストールされません。 +interactive apply は `Install the cx/cc environment? [y/N]` と確認し、Enter では +skip します。non-interactive install には `INSTALL_CXCC=1`、確認なしで skip する +場合は `INSTALL_CXCC=0` を設定します。 状態ファイル: diff --git a/README.ko.md b/README.ko.md index e6be70d..004ff01 100644 --- a/README.ko.md +++ b/README.ko.md @@ -70,7 +70,7 @@ INSTALL_CLAUDE=1 bash ./bootstrap.sh INSTALL_NODE=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FASTFETCH=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_MODERN_CLI=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles -INSTALL_CXCC=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles +INSTALL_CXCC=1 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FONTS=0 bash ./bootstrap.sh INSTALL_WINDOWS_FONTS_FROM_WSL=0 bash ./bootstrap.sh DOTFILES_USE_SUDO=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles @@ -92,7 +92,7 @@ DOTFILES_USE_SUDO=1 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/ - 호환 가능한 fastfetch를 `~/.local/bin`에 설치 - 시스템 패키지 설치가 켜져 있으면 Node.js와 npm 설치 - 현재 사용자 font 디렉터리에 0xProto Nerd Font 설치 -- 고정 버전 cxcc와 `cx`, `cc`, `mcp`를 로드하는 PowerShell/Zsh hook +- 선택 시 고정 버전 cxcc와 `cx`, `cc`, `mcp`를 로드하는 PowerShell/Zsh hook zsh가 없고 build tool이 있으면 zsh를 `~/.local`에 빌드합니다. 오래된 Linux에서는 fastfetch polyfilled binary를 우선 사용하고, 맞는 binary가 없으면 전체 apply를 @@ -121,7 +121,7 @@ interactive alias는 보수적으로만 켭니다. `du` -> `dust`, `df` -> `duf` ## CX/CC AI Profile 도구 -dotfiles는 고정 버전 cxcc를 설치하고 가벼운 shell function으로 Codex와 Claude Code의 +dotfiles는 고정 버전 cxcc를 선택하여 설치하고 가벼운 shell function으로 Codex와 Claude Code의 로컬 상태를 전환합니다. CLI를 직접 실행하지는 않습니다. 명령 구현과 cross-platform test는 cxcc가, version pin, install hook, loader 연결, default user config는 이 repo가 관리합니다. @@ -160,9 +160,10 @@ Payload: ~/.local/share/cxcc/versions/v0.1.0/ ``` release tag, immutable commit, installer digest, platform artifact digest는 -`.chezmoidata.toml`에 함께 있습니다. 대응하는 pin을 모두 갱신하고 `chezmoi apply`를 -실행하면 upgrade할 수 있습니다. `INSTALL_CXCC=0`은 설치를 건너뛰며, 변수를 제거한 -다음 apply부터 정상 설치가 다시 시작됩니다. +`.chezmoidata.toml`에 함께 있습니다. cxcc는 기본적으로 설치하지 않습니다. +interactive apply는 `Install the cx/cc environment? [y/N]`라고 묻고 Enter를 누르면 +건너뜁니다. non-interactive 설치에는 `INSTALL_CXCC=1`, 질문 없이 건너뛰려면 +`INSTALL_CXCC=0`을 설정합니다. 상태 파일: diff --git a/README.md b/README.md index 1fb4855..d062db7 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ INSTALL_CLAUDE=1 bash ./bootstrap.sh INSTALL_NODE=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FASTFETCH=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_MODERN_CLI=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles -INSTALL_CXCC=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles +INSTALL_CXCC=1 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FONTS=0 bash ./bootstrap.sh INSTALL_WINDOWS_FONTS_FROM_WSL=0 bash ./bootstrap.sh DOTFILES_USE_SUDO=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles @@ -94,8 +94,8 @@ The base layer installs or configures: - latest compatible fastfetch in `~/.local/bin` - Node.js and npm by default when system package installation is enabled - 0xProto Nerd Fonts in the current user's font directory -- a pinned cxcc release plus PowerShell/Zsh loader hooks for `cx`, `cc`, and - `mcp` +- when selected, a pinned cxcc release plus PowerShell/Zsh loader hooks for + `cx`, `cc`, and `mcp` If `zsh` is unavailable but build tools are present, zsh is built into `~/.local`. On older Linux systems, fastfetch falls back to its polyfilled @@ -124,7 +124,7 @@ over standard commands. ## CX/CC AI Profile Tools -The dotfiles install a pinned cxcc release, then load its lightweight shell +The dotfiles can install a pinned cxcc release, then load its lightweight shell functions for switching local Codex and Claude Code state without launching either CLI. cxcc owns the command implementation and its cross-platform tests; this repo owns the version pin, installation hook, loader wiring, and default @@ -164,9 +164,10 @@ Payload: ~/.local/share/cxcc/versions/v0.1.0/ ``` The release tag, immutable commit, installer digest, and platform artifact -digests are stored together in `.chezmoidata.toml`. Update all matching pins -and run `chezmoi apply` to upgrade. Set `INSTALL_CXCC=0` to skip the install -hook; a later apply without the variable resumes normal installation. +digests are stored together in `.chezmoidata.toml`. cxcc is not installed by +default. An interactive apply asks `Install the cx/cc environment? [y/N]`; +pressing Enter skips it. Set `INSTALL_CXCC=1` to install non-interactively or +`INSTALL_CXCC=0` to skip without prompting. Runtime state: diff --git a/README.zh-CN.md b/README.zh-CN.md index 3a96bc3..d33b45b 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -68,7 +68,7 @@ INSTALL_CLAUDE=1 bash ./bootstrap.sh INSTALL_NODE=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FASTFETCH=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_MODERN_CLI=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles -INSTALL_CXCC=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles +INSTALL_CXCC=1 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles INSTALL_FONTS=0 bash ./bootstrap.sh INSTALL_WINDOWS_FONTS_FROM_WSL=0 bash ./bootstrap.sh DOTFILES_USE_SUDO=0 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/dotfiles @@ -89,7 +89,7 @@ DOTFILES_USE_SUDO=1 sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply Tim-1e/ - 兼容的 fastfetch 到 `~/.local/bin` - Node.js 和 npm,默认随系统包安装 - 0xProto Nerd Font 到当前用户字体目录 -- 固定版本的 cxcc,以及加载 `cx`、`cc`、`mcp` 的 PowerShell/Zsh hook +- 选择安装时提供固定版本的 cxcc,以及加载 `cx`、`cc`、`mcp` 的 PowerShell/Zsh hook 如果系统没有 zsh,但有编译工具,脚本会把 zsh 编译到 `~/.local`。老 Linux 系统上,fastfetch 会优先尝试 polyfilled binary;没有合适版本时跳过,不让整个 @@ -116,7 +116,7 @@ apply 失败。 ## CX/CC AI Profile 工具 -dotfiles 安装固定版本的 cxcc,再加载其轻量 shell function,用于切换 Codex 和 +dotfiles 可安装固定版本的 cxcc,再加载其轻量 shell function,用于切换 Codex 和 Claude Code 的本地状态,但不会直接启动 CLI。命令实现和跨平台测试归 cxcc 仓库 维护;本仓库只负责版本钉住、安装 hook、loader 接线和默认用户配置: @@ -154,8 +154,9 @@ Payload: ~/.local/share/cxcc/versions/v0.1.0/ ``` release tag、不可变 commit、installer digest 和平台 artifact digest 统一位于 -`.chezmoidata.toml`;同步更新这些 pin 后运行 `chezmoi apply` 即可升级。设置 -`INSTALL_CXCC=0` 会跳过安装,之后取消变量再 apply 即可恢复。 +`.chezmoidata.toml`。cxcc 默认不安装;交互 apply 会询问 +`Install the cx/cc environment? [y/N]`,直接回车即跳过。非交互安装设置 +`INSTALL_CXCC=1`,需要无提示跳过时设置 `INSTALL_CXCC=0`。 运行状态: diff --git a/scripts/install/cxcc.ps1 b/scripts/install/cxcc.ps1 index 77dfac0..6a9c2a7 100644 --- a/scripts/install/cxcc.ps1 +++ b/scripts/install/cxcc.ps1 @@ -22,8 +22,26 @@ foreach ($digest in @($InstallerSha256, $ArtifactSha256)) { if ($digest -notmatch '^[0-9a-f]{64}$') { throw "cxcc SHA-256 pins must contain 64 lowercase hexadecimal characters." } } -if ($env:INSTALL_CXCC -ceq "0") { - Write-Host "Skipping cxcc installation because INSTALL_CXCC=0." +if ([string]::IsNullOrEmpty($env:INSTALL_CXCC)) { + $shouldInstall = $false + if ([Environment]::UserInteractive -and -not [Console]::IsInputRedirected -and -not [Console]::IsOutputRedirected) { + try { + $answer = Read-Host "Install the cx/cc environment? [y/N]" + $shouldInstall = ([string]$answer).Trim() -match '^(?i:y|yes)$' + } catch { + $shouldInstall = $false + } + } +} elseif ($env:INSTALL_CXCC -ceq "1") { + $shouldInstall = $true +} elseif ($env:INSTALL_CXCC -ceq "0") { + $shouldInstall = $false +} else { + throw "INSTALL_CXCC must be 0 or 1." +} + +if (-not $shouldInstall) { + Write-Host "Skipping cxcc installation. Set INSTALL_CXCC=1 to install it." return } diff --git a/scripts/install/cxcc.sh b/scripts/install/cxcc.sh index 10202b1..977c8d5 100755 --- a/scripts/install/cxcc.sh +++ b/scripts/install/cxcc.sh @@ -29,8 +29,30 @@ sha256_file() { [[ "$installer_sha256" =~ ^[0-9a-f]{64}$ ]] || fail "cxcc installer SHA-256 pin must contain 64 lowercase hexadecimal characters." [[ "$artifact_sha256" =~ ^[0-9a-f]{64}$ ]] || fail "cxcc artifact SHA-256 pin must contain 64 lowercase hexadecimal characters." -if [ "${INSTALL_CXCC:-1}" = "0" ]; then - echo "Skipping cxcc installation because INSTALL_CXCC=0." +case "${INSTALL_CXCC-}" in + 1) + should_install=1 + ;; + 0) + should_install=0 + ;; + "") + should_install=0 + if [ -t 0 ] && [ -t 1 ]; then + printf 'Install the cx/cc environment? [y/N] ' + IFS= read -r answer || answer="" + case "$answer" in + [Yy] | [Yy][Ee][Ss]) should_install=1 ;; + esac + fi + ;; + *) + fail "INSTALL_CXCC must be 0 or 1." + ;; +esac + +if [ "$should_install" != "1" ]; then + echo "Skipping cxcc installation. Set INSTALL_CXCC=1 to install it." exit 0 fi diff --git a/test/cxcc-consumer-smoke.ps1 b/test/cxcc-consumer-smoke.ps1 index 2dc258b..5e0e374 100644 --- a/test/cxcc-consumer-smoke.ps1 +++ b/test/cxcc-consumer-smoke.ps1 @@ -22,6 +22,7 @@ foreach ($required in @($installer, $hook, $dataFile, $profileSource)) { $dataText = Get-Content -LiteralPath $dataFile -Raw $hookText = Get-Content -LiteralPath $hook -Raw $profileText = Get-Content -LiteralPath $profileSource -Raw +$installerText = Get-Content -LiteralPath $installer -Raw Assert-True ($dataText -match '(?m)^version = "v0\.1\.0"$') "dotfiles does not pin cxcc v0.1.0." Assert-True $dataText.Contains($expectedCommit) "dotfiles does not pin an immutable cxcc commit." Assert-True $dataText.Contains($expectedInstallerSha256) "dotfiles does not pin the PowerShell installer digest." @@ -34,6 +35,8 @@ Assert-True $hookText.Contains(".cxcc.windowsArtifactSha256") "PowerShell hook d Assert-True ($profileText -match 'CXCC_HOME') "PowerShell profile does not honor CXCC_HOME." Assert-True ($profileText -match 'load\.ps1') "PowerShell profile does not load the stable cxcc loader." Assert-True ($profileText -notmatch 'Scripts\\ai-env\.ps1') "PowerShell profile still loads the legacy ai-env implementation." +Assert-True $installerText.Contains("Install the cx/cc environment? [y/N]") "PowerShell installer does not offer the default-No cx/cc prompt." +Assert-True ($installerText -match 'INSTALL_CXCC.+1') "PowerShell installer does not support INSTALL_CXCC=1." $legacyPaths = @( "Documents/PowerShell/Scripts/ai-env.ps1", @@ -150,6 +153,12 @@ $loader = @( $env:CXCC_TEST_INSTALL_LOG = $installLog Remove-Item -LiteralPath Env:\INSTALL_CXCC -ErrorAction SilentlyContinue + & $installer @installerArguments + Assert-True (-not (Test-Path -LiteralPath $installRoot)) "Unset INSTALL_CXCC installed cxcc in a non-interactive session." + Assert-True (-not (Test-Path -LiteralPath $downloadLog)) "Unset INSTALL_CXCC accessed the network in a non-interactive session." + Assert-StatePreserved + + $env:INSTALL_CXCC = "1" & $installer @installerArguments $downloadLines = @(Get-Content -LiteralPath $downloadLog) Assert-True ($downloadLines.Count -eq 2) "PowerShell consumer did not download the installer and artifact exactly once." @@ -185,11 +194,17 @@ $loader = @( Assert-True (@(Get-Content -LiteralPath $downloadLog).Count -eq 4) "INSTALL_CXCC=0 accessed the network." Assert-StatePreserved + $env:INSTALL_CXCC = "yes" + $invalidInstallChoiceFailed = $false + try { & $installer @installerArguments } catch { $invalidInstallChoiceFailed = $true } + Assert-True $invalidInstallChoiceFailed "PowerShell consumer accepted INSTALL_CXCC other than 0 or 1." + Assert-True (@(Get-Content -LiteralPath $downloadLog).Count -eq 4) "Invalid INSTALL_CXCC accessed the network." + $invalidVersionFailed = $false try { & $installer -Version "main" -Commit $testCommit -InstallerSha256 $testInstallerSha256 -ArtifactSha256 $testArtifactSha256 } catch { $invalidVersionFailed = $true } Assert-True $invalidVersionFailed "PowerShell consumer accepted an unpinned version." - Remove-Item -LiteralPath Env:\INSTALL_CXCC -ErrorAction SilentlyContinue + $env:INSTALL_CXCC = "1" $env:CXCC_HOME = Join-Path $testHome "bad\cxcc" $checksumFailed = $false try { & $installer -Version $expectedVersion -Commit $testCommit -InstallerSha256 ("0" * 64) -ArtifactSha256 $testArtifactSha256 } catch { $checksumFailed = $true } diff --git a/test/cxcc-consumer-smoke.sh b/test/cxcc-consumer-smoke.sh index e935649..58d4dad 100755 --- a/test/cxcc-consumer-smoke.sh +++ b/test/cxcc-consumer-smoke.sh @@ -44,7 +44,9 @@ grep -Fq '.cxcc.posixArtifactSha256' "$HOOK" || fail "Shell hook does not use th grep -Fq -- '--connect-timeout' "$INSTALLER" || fail "Shell consumer download has no connection timeout." grep -Fq -- '--max-time' "$INSTALLER" || fail "Shell consumer download has no total timeout." grep -Fq -- '--ipv4' "$INSTALLER" || fail "Shell consumer download has no IPv4 fallback." -grep -Fq 'INSTALL_CXCC' "$FULL_SMOKE" || fail "Full smoke does not honor INSTALL_CXCC=0." +grep -Fq 'Install the cx/cc environment? [y/N]' "$INSTALLER" || fail "Shell installer does not offer the default-No cx/cc prompt." +grep -Fq 'INSTALL_CXCC=1' "$INSTALLER" || fail "Shell installer does not support INSTALL_CXCC=1." +grep -Fq '${INSTALL_CXCC:-0}' "$FULL_SMOKE" || fail "Full smoke does not default cxcc checks to disabled." grep -Fq 'CXCC_HOME' "$ZSHRC" || fail "Zsh profile does not honor CXCC_HOME." grep -Fq '/load.sh' "$ZSHRC" || fail "Zsh profile does not load the stable cxcc loader." ! grep -Fq '.local/share/ai-env/ai-env.sh' "$ZSHRC" || fail "Zsh profile still loads the legacy ai-env implementation." @@ -180,7 +182,13 @@ run_installer() { bash "$INSTALLER" "$EXPECTED_VERSION" "$test_commit" "$test_installer_sha256" "$test_artifact_sha256" } +unset INSTALL_CXCC run_installer +[ ! -e "$install_root" ] || fail "Unset INSTALL_CXCC installed cxcc in a non-interactive session." +[ ! -e "$curl_log" ] || fail "Unset INSTALL_CXCC accessed the network in a non-interactive session." +assert_state_preserved + +INSTALL_CXCC=1 run_installer [ "$(sed -n '1p' "$curl_log")" = "https://raw.githubusercontent.com/Tim-1e/cxcc/$test_commit/install.sh" ] || fail "Shell consumer used a mutable installer URL." [ "$(sed -n '2p' "$curl_log")" = "https://github.com/Tim-1e/cxcc/releases/download/$EXPECTED_VERSION/cxcc-$EXPECTED_VERSION-posix.tar.gz" ] || fail "Shell consumer used an unexpected artifact URL." grep -Eq "^--version $EXPECTED_VERSION --artifact .*/cxcc-$EXPECTED_VERSION-posix\.tar\.gz --sha256 $test_artifact_sha256$" "$install_log" || fail "Shell consumer passed unexpected installer arguments." @@ -189,12 +197,12 @@ grep -Fq '"version":"v0.1.0"' "$install_root/current.json" || fail "Shell consum [ "$(cat "$install_root/versions/$EXPECTED_VERSION/VERSION")" = "$EXPECTED_VERSION" ] || fail "Shell consumer payload VERSION is invalid." assert_state_preserved -run_installer +INSTALL_CXCC=1 run_installer [ "$(wc -l <"$curl_log" | tr -d ' ')" = "2" ] || fail "Repeated Shell apply downloaded cxcc again." assert_state_preserved rm "$install_root/versions/$EXPECTED_VERSION/src/shell/cxcc.sh" -run_installer +INSTALL_CXCC=1 run_installer [ "$(wc -l <"$curl_log" | tr -d ' ')" = "4" ] || fail "Shell consumer ignored a damaged cxcc payload." assert_state_preserved @@ -204,11 +212,16 @@ INSTALL_CXCC=0 run_installer [ "$(wc -l <"$curl_log" | tr -d ' ')" = "4" ] || fail "INSTALL_CXCC=0 accessed the network." assert_state_preserved +if INSTALL_CXCC=yes run_installer >/dev/null 2>&1; then + fail "Shell consumer accepted INSTALL_CXCC other than 0 or 1." +fi +[ "$(wc -l <"$curl_log" | tr -d ' ')" = "4" ] || fail "Invalid INSTALL_CXCC accessed the network." + if HOME="$test_home" CXCC_HOME="$install_root" PATH="$fake_bin:$PATH" bash "$INSTALLER" main "$test_commit" "$test_installer_sha256" "$test_artifact_sha256" >/dev/null 2>&1; then fail "Shell consumer accepted an unpinned version." fi -if HOME="$test_home" \ +if INSTALL_CXCC=1 HOME="$test_home" \ CXCC_HOME="$test_home/bad/cxcc" \ CXCC_TEST_CURL_LOG="$curl_log" \ CXCC_TEST_INSTALL_LOG="$install_log" \ diff --git a/test/smoke.sh b/test/smoke.sh index 1b11f85..c4fb0d2 100755 --- a/test/smoke.sh +++ b/test/smoke.sh @@ -55,9 +55,9 @@ else fi bash "$SOURCE_DIR/test/fonts-smoke.sh" -if [ "${INSTALL_CXCC:-1}" = "0" ]; then - echo "skipped cxcc smoke: INSTALL_CXCC=0" >&2 -else +if [ "${INSTALL_CXCC:-0}" = "0" ]; then + echo "skipped cxcc smoke: INSTALL_CXCC is not enabled" >&2 +elif [ "$INSTALL_CXCC" = "1" ]; then bash "$SOURCE_DIR/test/cxcc-consumer-smoke.sh" cxcc_root="${CXCC_HOME:-$HOME/.local/share/cxcc}" @@ -76,6 +76,9 @@ else cx help >/dev/null cc help >/dev/null mcp help >/dev/null +else + echo "INSTALL_CXCC must be 0 or 1." >&2 + exit 1 fi FASTFETCH_OK=0