Add wrapper-script env var support for claude-code's self-update guard #2
Loading…
Reference in a new issue
No description provided.
Delete branch "worktree-add-wrapper-env-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
claude-codepackage (2.1.273-1, an AUR build) wraps its real binary in a/usr/bin/claudescript that setsDISABLE_UPDATES=1/DISABLE_INSTALLATION_CHECKS=1beforeexec-ing/opt/claude-code/bin/claude— almost certainly to stop Claude Code's own self-updater from fighting with a package manager already managing it, which applies just as much to a pkgwatch-managed install.Package::env(sortedBTreeMap). When set and non-empty,builder.rsinstalls the real binary under/usr/lib/<pkgname>/and generates a/usr/bin/<binary_name>wrapper that exports the declared vars beforeexec-ing it, written inline via a quoted heredoc (no bash expansion at PKGBUILD-build time).$(dirname "$0")rather than a hardcoded absolute path —/bin/shisbashon this box and sets$0to the full resolved path when found viaPATH(confirmed empirically), so the same wrapper resolves correctly both undersanity.rs's staging-directorypkgdircheck and after a realpacmaninstall.claude-code.tomlto declare both vars.Test plan
cargo test— 87/87 passing (added config + builder tests for the newenvfield, wrapper generation, and validation)cargo clippy -- -D warningsclean,cargo fmt --checkcleanPKGWATCH_REPO_DIR):check -> fetch -> verify -> review claude-code --approve -> build -> sanity-check -> publishall pass, sanity check now runs through the wrapper (not the raw binary) and still passesexecline for an env dump and diffed)🤖 Generated with Claude Code