download url fixes for freebsd

This commit is contained in:
Akash Manohar J 2016-02-10 03:32:08 +00:00
parent 4f850e5e49
commit 4dff7928d8

View File

@ -17,7 +17,8 @@ install_nodejs() {
# running this in a subshell
# we don't want to disturb current working dir
(
if [ "$install_type" != "version" ]; then
unamestr=`uname`
if [ "$install_type" != "version" ] || ([ "$unamestr" != "Linux" ] && [ "$unamestr" != "Darwin" ]); then
tar zxf $source_path -C $install_path --strip-components=1 || exit 1
cd $install_path
@ -79,6 +80,7 @@ download_source_file() {
local version=$2
local download_path=$3
local download_url=$(get_download_url $install_type $version)
echo $download_url
curl -Lo $download_path -C - $download_url
}
@ -90,7 +92,8 @@ get_download_file_path() {
local tmp_download_dir=$3
if [ "$install_type" = "version" ]; then
unamestr=`uname`
if [ "$install_type" == "version" ] && ([ "$unamestr" == "Linux" ] || [ "$unamestr" == "Darwin" ]); then
if [[ "$operating_system" =~ "x86_64" ]]; then
local cpu_type="x64"
else
@ -115,7 +118,8 @@ get_download_url() {
local version=$2
local operating_system=$(uname -a)
if [ "$install_type" = "version" ]; then
unamestr=`uname`
if [ "$install_type" == "version" ] && ([ "$unamestr" == "Linux" ] || [ "$unamestr" == "Darwin" ]); then
if [[ "$operating_system" =~ "x86_64" ]]; then
local cpu_type="x64"
else
@ -128,7 +132,11 @@ get_download_url() {
echo "http://nodejs.org/dist/v${version}/node-v${version}-linux-${cpu_type}.tar.gz"
fi
else
echo "https://github.com/nodejs/node/archive/${version}.tar.gz"
if [ "$install_type" == "version" ]; then
echo "https://github.com/nodejs/node/archive/v${version}.tar.gz"
else
echo "https://github.com/nodejs/node/archive/${version}.tar.gz"
fi
fi
}