diff --git a/build.sh b/build.sh index 94753231..a01940cd 100755 --- a/build.sh +++ b/build.sh @@ -1465,9 +1465,18 @@ EOF fi mkdir -p "${MOUNT_POINT}/home/clawdie" "${MOUNT_POINT}/etc/profile.d" "${MOUNT_POINT}/etc/skel" + + # Install the canonical npm-global profile snippet (shared with agent-jail-bootstrap.sh). + { + printf 'NPM_PREFIX="/opt/clawdie/npm-global"\n' + cat "${SCRIPT_DIR}/../colibri/packaging/freebsd/clawdie-npm-profile.sh" + } > "${MOUNT_POINT}/etc/profile.d/clawdie-npm.sh" + chmod 0644 "${MOUNT_POINT}/etc/profile.d/clawdie-npm.sh" + + # ISO-specific environment (PATH, locale, colibri socket). Sources the + # shared npm snippet rather than duplicating it. cat > "${MOUNT_POINT}/etc/profile.d/clawdie.sh" <<'EOF' # Clawdie live operator environment. -_clawdie_npm_prefix="/opt/clawdie/npm-global" _clawdie_base_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" _clawdie_path_has() { case ":${PATH:-}:" in @@ -1475,10 +1484,6 @@ _clawdie_path_has() { *) return 1 ;; esac } -export npm_config_prefix="${_clawdie_npm_prefix}" -export NPM_CONFIG_PREFIX="${_clawdie_npm_prefix}" -export NPM_CONFIG_UPDATE_NOTIFIER=false -export NO_UPDATE_NOTIFIER=1 export LANG="${LANG:-en_US.UTF-8}" export LC_ALL="${LC_ALL:-en_US.UTF-8}" if [ -z "${PATH:-}" ]; then @@ -1488,13 +1493,13 @@ else _clawdie_path_has "${_clawdie_dir}" || PATH="${PATH}:${_clawdie_dir}" done fi -_clawdie_path_has "${_clawdie_npm_prefix}/bin" || PATH="${_clawdie_npm_prefix}/bin:${PATH}" +# npm-global bin + npm config — canonical snippet shared with agent jails +[ -r /etc/profile.d/clawdie-npm.sh ] && . /etc/profile.d/clawdie-npm.sh export PATH # Colibri daemon socket — needed for 'colibri' CLI without --socket export COLIBRI_DAEMON_SOCKET="/var/run/colibri/colibri.sock" -unset _clawdie_npm_prefix unset _clawdie_base_path unset -f _clawdie_path_has 2>/dev/null || true EOF