From 108101699157449ad2c82a70f52e6731b6425bef Mon Sep 17 00:00:00 2001 From: Sam & Claude Date: Sun, 21 Jun 2026 16:21:08 +0200 Subject: [PATCH] fix(bootstrap): unify npm-global PATH snippet into one shared file Closes #122. Creates packaging/freebsd/clawdie-npm-profile.sh as the single source for npm PATH + npm config. The agent-jail bootstrap installs it with NPM_PREFIX baked in, replacing the inline heredoc. The clawdie-iso build.sh installs the same file. Before: two divergent heredocs, different filenames, different prefixes. Now: one file, both environments, parameterized prefix. --- packaging/freebsd/agent-jail-bootstrap.sh | 15 ++++++--------- packaging/freebsd/clawdie-npm-profile.sh | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 packaging/freebsd/clawdie-npm-profile.sh diff --git a/packaging/freebsd/agent-jail-bootstrap.sh b/packaging/freebsd/agent-jail-bootstrap.sh index 863ca8b..a87e3a1 100755 --- a/packaging/freebsd/agent-jail-bootstrap.sh +++ b/packaging/freebsd/agent-jail-bootstrap.sh @@ -83,16 +83,13 @@ if [ ! -e "${NPM_PREFIX}/bin/pi" ]; then fi cp -a "${NPM_PREFIX}/bin/pi" "${JAIL_ROOT}${NPM_PREFIX}/bin/pi" -# Put the npm-global bin on PATH for every login shell. Canonical mechanism -# (same shape as the clawdie-iso image): the PATH content lives in one managed -# /etc/profile.d snippet derived from NPM_PREFIX, and /etc/profile sources it — -# not a per-user, single-shell ~/.profile line that drifts from the prefix. +# Put the npm-global bin on PATH for every login shell. Install the canonical +# snippet from colibri (same file the ISO image uses) with NPM_PREFIX baked in. install -d -m 0755 "${JAIL_ROOT}/etc/profile.d" -cat > "${JAIL_ROOT}/etc/profile.d/clawdie-npm.sh" < "${JAIL_ROOT}/etc/profile.d/clawdie-npm.sh" chmod 0644 "${JAIL_ROOT}/etc/profile.d/clawdie-npm.sh" if ! grep -q '/etc/profile.d/clawdie-npm.sh' "${JAIL_ROOT}/etc/profile" 2>/dev/null; then diff --git a/packaging/freebsd/clawdie-npm-profile.sh b/packaging/freebsd/clawdie-npm-profile.sh new file mode 100644 index 0000000..8404cf6 --- /dev/null +++ b/packaging/freebsd/clawdie-npm-profile.sh @@ -0,0 +1,18 @@ +# Clawdie npm-global bin on PATH — single source for ISO image and agent jails. +# Installed by: colibri agent-jail-bootstrap.sh and clawdie-iso build.sh. +# NPM_PREFIX is set by the installer before sourcing this file. + +if [ -z "${NPM_PREFIX:-}" ]; then + echo "clawdie-npm-profile: NPM_PREFIX not set — npm-global not added to PATH" >&2 + return 0 2>/dev/null || true +fi + +case ":${PATH:-}:" in + *:"${NPM_PREFIX}/bin":*) ;; + *) PATH="${NPM_PREFIX}/bin:${PATH}"; export PATH ;; +esac + +export npm_config_prefix="${NPM_PREFIX}" +export NPM_CONFIG_PREFIX="${NPM_PREFIX}" +export NPM_CONFIG_UPDATE_NOTIFIER=false +export NO_UPDATE_NOTIFIER=1