From 79ad72d1160f83e4fa3778a0cb18ae0c1c693109 Mon Sep 17 00:00:00 2001 From: Bob Bregant II Date: Sun, 19 Dec 2021 02:58:18 +0000 Subject: [PATCH] [Fix] Update `nvm_extract_tarball` to support OpenBSD Fixes #2660. --- nvm.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index 01607ff..1a811f7 100644 --- a/nvm.sh +++ b/nvm.sh @@ -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() {