|
|
@ -46,14 +46,16 @@ shopt -s extglob
|
|
|
|
# Try to figure out the os and arch for binary fetching
|
|
|
|
# Try to figure out the os and arch for binary fetching
|
|
|
|
uname="$(uname -a)"
|
|
|
|
uname="$(uname -a)"
|
|
|
|
os=
|
|
|
|
os=
|
|
|
|
arch=x86
|
|
|
|
arch=
|
|
|
|
case "$uname" in
|
|
|
|
case "$uname" in
|
|
|
|
Linux\ *) os=linux ;;
|
|
|
|
Linux\ *) os=linux ;;
|
|
|
|
Darwin\ *) os=darwin ;;
|
|
|
|
Darwin\ *) os=darwin ;;
|
|
|
|
SunOS\ *) os=sunos ;;
|
|
|
|
SunOS\ *) os=sunos ;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
case "$uname" in
|
|
|
|
case "$uname" in
|
|
|
|
|
|
|
|
*i386*) arch=x86 ;;
|
|
|
|
*x86_64*) arch=x64 ;;
|
|
|
|
*x86_64*) arch=x64 ;;
|
|
|
|
|
|
|
|
*raspberrypi*) arch=arm-pi ;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
tar=${TAR-tar}
|
|
|
|
tar=${TAR-tar}
|
|
|
@ -213,12 +215,13 @@ nave_fetch () {
|
|
|
|
|
|
|
|
|
|
|
|
local url
|
|
|
|
local url
|
|
|
|
local urls=(
|
|
|
|
local urls=(
|
|
|
|
|
|
|
|
"https://iojs.org/dist/v$version/iojs-v$version.tar.gz"
|
|
|
|
"http://nodejs.org/dist/v$version/node-v$version.tar.gz"
|
|
|
|
"http://nodejs.org/dist/v$version/node-v$version.tar.gz"
|
|
|
|
"http://nodejs.org/dist/node-v$version.tar.gz"
|
|
|
|
"http://nodejs.org/dist/node-v$version.tar.gz"
|
|
|
|
"http://nodejs.org/dist/node-$version.tar.gz"
|
|
|
|
"http://nodejs.org/dist/node-$version.tar.gz"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
for url in "${urls[@]}"; do
|
|
|
|
for url in "${urls[@]}"; do
|
|
|
|
curl -#Lf "$url" > "$src".tgz
|
|
|
|
get -#Lf "$url" > "$src".tgz
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
$tar xzf "$src".tgz -C "$src" --strip-components=1
|
|
|
|
$tar xzf "$src".tgz -C "$src" --strip-components=1
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
@ -234,6 +237,11 @@ nave_fetch () {
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get () {
|
|
|
|
|
|
|
|
curl -H "user-agent:nave/$(curl --version | head -n1)" "$@"
|
|
|
|
|
|
|
|
return $?
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
build () {
|
|
|
|
build () {
|
|
|
|
local version="$1"
|
|
|
|
local version="$1"
|
|
|
|
|
|
|
|
|
|
|
@ -248,25 +256,27 @@ build () {
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
if [ $binavail -eq 1 ]; then
|
|
|
|
if [ $binavail -eq 1 ]; then
|
|
|
|
local t="$version-$os-$arch"
|
|
|
|
local t="$version-$os-$arch"
|
|
|
|
local url="http://nodejs.org/dist/v$version/node-v${t}.tar.gz"
|
|
|
|
|
|
|
|
local tgz="$NAVE_SRC/$t.tgz"
|
|
|
|
local tgz="$NAVE_SRC/$t.tgz"
|
|
|
|
curl -#Lf "$url" > "$tgz"
|
|
|
|
for url in "https://iojs.org/dist/v$version/iojs-v${t}.tar.gz" \
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
"http://nodejs.org/dist/v$version/node-v${t}.tar.gz"; do
|
|
|
|
# binary download failed. oh well. cleanup, and proceed.
|
|
|
|
get -#Lf "$url" > "$tgz"
|
|
|
|
rm "$tgz"
|
|
|
|
|
|
|
|
echo "Binary download failed, trying source." >&2
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
# unpack straight into the build target.
|
|
|
|
|
|
|
|
$tar xzf "$tgz" -C "$2" --strip-components 1
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
|
|
|
# binary download failed. oh well. cleanup, and proceed.
|
|
|
|
rm "$tgz"
|
|
|
|
rm "$tgz"
|
|
|
|
nave_uninstall "$version"
|
|
|
|
else
|
|
|
|
echo "Binary unpack failed, trying source." >&2
|
|
|
|
# unpack straight into the build target.
|
|
|
|
|
|
|
|
$tar xzf "$tgz" -C "$2" --strip-components 1
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
|
|
|
rm "$tgz"
|
|
|
|
|
|
|
|
nave_uninstall "$version"
|
|
|
|
|
|
|
|
echo "Binary unpack failed, trying source." >&2
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# it worked!
|
|
|
|
|
|
|
|
echo "installed from binary" >&2
|
|
|
|
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# it worked!
|
|
|
|
done
|
|
|
|
echo "installed from binary" >&2
|
|
|
|
echo "Binary download failed, trying source." >&2
|
|
|
|
return 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -321,6 +331,9 @@ nave_usemain () {
|
|
|
|
|
|
|
|
|
|
|
|
nave_install () {
|
|
|
|
nave_install () {
|
|
|
|
local version=$(ver "$1")
|
|
|
|
local version=$(ver "$1")
|
|
|
|
|
|
|
|
if [ -z "$version" ]; then
|
|
|
|
|
|
|
|
fail "Must supply a version ('stable', 'latest' or numeric)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
if nave_installed "$version"; then
|
|
|
|
if nave_installed "$version"; then
|
|
|
|
echo "Already installed: $version" >&2
|
|
|
|
echo "Already installed: $version" >&2
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
@ -358,7 +371,7 @@ nave_ls () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nave_ls_remote () {
|
|
|
|
nave_ls_remote () {
|
|
|
|
curl -s http://nodejs.org/dist/ \
|
|
|
|
get -s http://nodejs.org/dist/ \
|
|
|
|
| version_list "remote" \
|
|
|
|
| version_list "remote" \
|
|
|
|
|| return 1
|
|
|
|
|| return 1
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -394,21 +407,22 @@ ver () {
|
|
|
|
nave_version_family () {
|
|
|
|
nave_version_family () {
|
|
|
|
local family="$1"
|
|
|
|
local family="$1"
|
|
|
|
family="${family/v/}"
|
|
|
|
family="${family/v/}"
|
|
|
|
curl -s http://nodejs.org/dist/ \
|
|
|
|
{ get -s http://nodejs.org/dist/;
|
|
|
|
|
|
|
|
get -s https://iojs.org/dist/; } \
|
|
|
|
| egrep -o $family'\.[0-9]+' \
|
|
|
|
| egrep -o $family'\.[0-9]+' \
|
|
|
|
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
|
|
|
|
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
|
|
|
|
| tail -n1
|
|
|
|
| tail -n1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nave_latest () {
|
|
|
|
nave_latest () {
|
|
|
|
curl -s http://nodejs.org/dist/ \
|
|
|
|
get -s https://iojs.org/dist/ \
|
|
|
|
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
|
|
|
|
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
|
|
|
|
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
|
|
|
|
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
|
|
|
|
| tail -n1
|
|
|
|
| tail -n1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nave_stable () {
|
|
|
|
nave_stable () {
|
|
|
|
curl -s http://nodejs.org/dist/ \
|
|
|
|
get -s http://nodejs.org/dist/ \
|
|
|
|
| egrep -o '[0-9]+\.[0-9]*[02468]\.[0-9]+' \
|
|
|
|
| egrep -o '[0-9]+\.[0-9]*[02468]\.[0-9]+' \
|
|
|
|
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
|
|
|
|
| sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
|
|
|
|
| tail -n1
|
|
|
|
| tail -n1
|
|
|
@ -636,6 +650,7 @@ add_named_env () {
|
|
|
|
ensure_dir "$NAVE_ROOT/$name/share/man"
|
|
|
|
ensure_dir "$NAVE_ROOT/$name/share/man"
|
|
|
|
|
|
|
|
|
|
|
|
ln -sf -- "$NAVE_ROOT/$version/bin/node" "$NAVE_ROOT/$name/bin/node"
|
|
|
|
ln -sf -- "$NAVE_ROOT/$version/bin/node" "$NAVE_ROOT/$name/bin/node"
|
|
|
|
|
|
|
|
ln -sf -- "$NAVE_ROOT/$version/bin/npm" "$NAVE_ROOT/$name/bin/npm"
|
|
|
|
ln -sf -- "$NAVE_ROOT/$version/bin/node-waf" "$NAVE_ROOT/$name/bin/node-waf"
|
|
|
|
ln -sf -- "$NAVE_ROOT/$version/bin/node-waf" "$NAVE_ROOT/$name/bin/node-waf"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|