Skip to content

Commit

Permalink
Add gzip fallback is xz detected
Browse files Browse the repository at this point in the history
* also exclude AIX
  • Loading branch information
refack committed Dec 1, 2018
1 parent 2219029 commit 3c9ee08
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion nvs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ nvs() {
curl -L -# "${NODE_URI}" -o "${NODE_ARCHIVE}"
fi

if [ ! -f "${NODE_ARCHIVE}" ] && [ "${NODE_ARCHIVE_EXT}" = ".tar.xz" ]; then
NODE_ARCHIVE_EXT=".tar.xz"
TAR_FLAGS="-Jxvf"
NODE_ARCHIVE="${NVS_HOME}/cache/${NODE_FULLNAME}${NODE_ARCHIVE_EXT}"
echo "Retry download bootstrap node from ${NODE_URI} in gz format"
if type noglob > /dev/null 2>&1; then
noglob curl -L -# "${NODE_URI}" -o "${NODE_ARCHIVE}"
else
curl -L -# "${NODE_URI}" -o "${NODE_ARCHIVE}"
fi
fi

if [ ! -f "${NODE_ARCHIVE}" ]; then
echo "Failed to download node binary."
return 1
Expand Down Expand Up @@ -160,7 +172,7 @@ nvsudo() {
sudo "NVS_CURRENT=${NVS_CURRENT}" "${NVS_ROOT}/nvs" $*
}

if [ ! "${NVS_OS}" = "win" ]; then
if [ ! "${NVS_OS}" = "win" ] && [ ! "${NVS_OS}" = "aix" ]; then
# Check if `tar` has xz support. Look for a minimum libarchive or gnutar version.
if [ -z "${NVS_USE_XZ}" ]; then
export LIBARCHIVE_VER="$(tar --version | sed -n "s/.*libarchive \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/p")"
Expand Down

0 comments on commit 3c9ee08

Please sign in to comment.