Skip to content

Commit

Permalink
bin/n: Option to download xz-compressed tarball
Browse files Browse the repository at this point in the history
To download an xz-compressed tarball, set the environment variable
"N_USE_XZ" to be non-empty before running n.
  • Loading branch information
DeeDeeG committed Jun 23, 2019
1 parent 13562ee commit 07d57b9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,11 @@ tarball_url() {

[ -n "$ARCH" ] && arch="$ARCH"

echo "${MIRROR[$DEFAULT]}v${version}/${BIN_NAME[$DEFAULT]}-v${version}-${os}-${arch}.tar.gz"
if [ -n "$N_USE_XZ" ]; then
echo "${MIRROR[$DEFAULT]}v${version}/${BIN_NAME[$DEFAULT]}-v${version}-${os}-${arch}.tar.xz"
else
echo "${MIRROR[$DEFAULT]}v${version}/${BIN_NAME[$DEFAULT]}-v${version}-${os}-${arch}.tar.gz"
fi

}

Expand Down Expand Up @@ -566,7 +570,11 @@ install() {
cd "$dir"

log fetch "$url"
$GET "$url" | tar -zx --strip-components=1
if test -n "$N_USE_XZ"; then
$GET "$url" | tar -Jx --strip-components=1
else
$GET "$url" | tar -zx --strip-components=1
fi
[ "$QUIET" == false ] && erase_line
rm -f "$dir/n.lock"

Expand Down

0 comments on commit 07d57b9

Please sign in to comment.