[Fix] Update `nvm_extract_tarball` to support OpenBSD

Fixes #2660.
Bob Bregant II 2021-12-19 02:58:18 +00:00 committed by Jordan Harband
parent ccd442d833
commit 79ad72d116
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 9 additions and 1 deletions

10
nvm.sh
View File

@ -2270,7 +2270,15 @@ nvm_extract_tarball() {
tar='gtar'
fi
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 || return 1
if [ "${NVM_OS}" = 'openbsd' ]; then
if [ "${tar_compression_flag}" = 'J' ]; then
command xzcat "${TARBALL}" | "${tar}" -xf - -C "${TMPDIR}" -s '/[^\/]*\///' || return 1
else
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" -s '/[^\/]*\///' || return 1
fi
else
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 || return 1
fi
}
nvm_get_make_jobs() {