Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ display_major_version() {
echo "${version}"
}

display_masked_url() {
echo "$1" | sed -r 's/(https?:\/\/[^:]+):([^@]+)@/\1:****@/'
}

#
# Synopsis: update_mirror_settings_for_version version
# e.g. <nightly/latest> means using download mirror and folder is nightly
Expand Down Expand Up @@ -793,15 +797,15 @@ install() {
log installing "${g_mirror_folder_name}-v$version"

local url="$(tarball_url "$version")"
is_ok "${url}" || abort "download preflight failed for '$version' (${url})"
is_ok "${url}" || abort "download preflight failed for '$version' ($(display_masked_url "${url}"))"

log mkdir "$dir"
mkdir -p "$dir" || abort "sudo required (or change ownership, or define N_PREFIX)"
touch "$dir/n.lock"

cd "${dir}" || abort "Failed to cd to ${dir}"

log fetch "$url"
log fetch "$(display_masked_url "${url}")"
do_get "${url}" | tar "$tarflag" --strip-components=1 --no-same-owner -f -
pipe_results=( "${PIPESTATUS[@]}" )
if [[ "${pipe_results[0]}" -ne 0 ]]; then
Expand Down Expand Up @@ -1241,7 +1245,7 @@ display_remote_index() {
do_get_index "${index_url}" | tail -n +2 | cut -f 1,3,10
if [[ "${PIPESTATUS[0]}" -ne 0 ]]; then
# Reminder: abort will only exit subshell, but consistent error display
abort "failed to download version index (${index_url})"
abort "failed to download version index ($(display_masked_url "${index_url}"))"
fi
}

Expand Down Expand Up @@ -1494,8 +1498,8 @@ function show_diagnostics() {
printf "\n\nSETTINGS\n"

printf "\nn\n"
echo "node mirror: ${N_NODE_MIRROR}"
echo "node downloads mirror: ${N_NODE_DOWNLOAD_MIRROR}"
echo "node mirror: $(display_masked_url "${N_NODE_MIRROR}")"
echo "node downloads mirror: $(display_masked_url "${N_NODE_DOWNLOAD_MIRROR}")"
echo "install destination: ${N_PREFIX}"
[[ -n "${N_PREFIX}" ]] && echo "PATH: ${PATH}"
echo "ls-remote max matches: ${N_MAX_REMOTE_MATCHES}"
Expand Down