fix(build): source shared npm-global snippet instead of inline heredoc
Completes colibri#122. The ISO now installs the canonical clawdie-npm-profile.sh from colibri (same file agent-jail-bootstrap uses). The ISO-specific clawdie.sh sources it rather than duplicating the npm PATH + npm config lines.
This commit is contained in:
parent
c029841ce9
commit
15d298f975
1 changed files with 12 additions and 7 deletions
19
build.sh
19
build.sh
|
|
@ -1465,9 +1465,18 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${MOUNT_POINT}/home/clawdie" "${MOUNT_POINT}/etc/profile.d" "${MOUNT_POINT}/etc/skel"
|
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'
|
cat > "${MOUNT_POINT}/etc/profile.d/clawdie.sh" <<'EOF'
|
||||||
# Clawdie live operator environment.
|
# 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_base_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
_clawdie_path_has() {
|
_clawdie_path_has() {
|
||||||
case ":${PATH:-}:" in
|
case ":${PATH:-}:" in
|
||||||
|
|
@ -1475,10 +1484,6 @@ _clawdie_path_has() {
|
||||||
*) return 1 ;;
|
*) return 1 ;;
|
||||||
esac
|
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 LANG="${LANG:-en_US.UTF-8}"
|
||||||
export LC_ALL="${LC_ALL:-en_US.UTF-8}"
|
export LC_ALL="${LC_ALL:-en_US.UTF-8}"
|
||||||
if [ -z "${PATH:-}" ]; then
|
if [ -z "${PATH:-}" ]; then
|
||||||
|
|
@ -1488,13 +1493,13 @@ else
|
||||||
_clawdie_path_has "${_clawdie_dir}" || PATH="${PATH}:${_clawdie_dir}"
|
_clawdie_path_has "${_clawdie_dir}" || PATH="${PATH}:${_clawdie_dir}"
|
||||||
done
|
done
|
||||||
fi
|
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
|
export PATH
|
||||||
|
|
||||||
# Colibri daemon socket — needed for 'colibri' CLI without --socket
|
# Colibri daemon socket — needed for 'colibri' CLI without --socket
|
||||||
export COLIBRI_DAEMON_SOCKET="/var/run/colibri/colibri.sock"
|
export COLIBRI_DAEMON_SOCKET="/var/run/colibri/colibri.sock"
|
||||||
|
|
||||||
unset _clawdie_npm_prefix
|
|
||||||
unset _clawdie_base_path
|
unset _clawdie_base_path
|
||||||
unset -f _clawdie_path_has 2>/dev/null || true
|
unset -f _clawdie_path_has 2>/dev/null || true
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue