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.
This commit is contained in:
parent
16c3b3db1b
commit
1081016991
2 changed files with 24 additions and 9 deletions
|
|
@ -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" <<EOF
|
||||
# Managed by agent-jail-bootstrap.sh — clawdie npm-global bin on PATH.
|
||||
PATH="${NPM_PREFIX}/bin:\$PATH"
|
||||
export PATH
|
||||
EOF
|
||||
{
|
||||
printf 'NPM_PREFIX="%s"\n' "${NPM_PREFIX}"
|
||||
cat "$(dirname "$0")/clawdie-npm-profile.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
|
||||
|
|
|
|||
18
packaging/freebsd/clawdie-npm-profile.sh
Normal file
18
packaging/freebsd/clawdie-npm-profile.sh
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue