mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
Omit node binary version numbers for simplicity
This commit is contained in:
parent
a55b2dec62
commit
29f359da68
10
bin/resin
10
bin/resin
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
NODE_VERSION="v0.12.0"
|
||||
|
||||
function unsupported_platform() {
|
||||
echo "Your platform (`uname -a`) is not supported." && exit 1
|
||||
}
|
||||
@ -17,19 +15,19 @@ esac
|
||||
|
||||
# Darwin
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
NODE_BIN="node-$NODE_VERSION-darwin-$ARCHITECTURE.bin"
|
||||
NODE_BIN="node-darwin-$ARCHITECTURE.bin"
|
||||
|
||||
# Linux
|
||||
elif [ "`expr substr $(uname -s) 1 5`" == "Linux" ]; then
|
||||
NODE_BIN="node-$NODE_VERSION-linux-$ARCHITECTURE.bin"
|
||||
NODE_BIN="node-linux-$ARCHITECTURE.bin"
|
||||
|
||||
# Win32
|
||||
elif [ "`expr substr $(uname -s) 1 10`" == "MINGW32_NT" ]; then
|
||||
NODE_BIN="node-$NODE_VERSION-win32-$ARCHITECTURE.exe"
|
||||
NODE_BIN="node-win32-$ARCHITECTURE.exe"
|
||||
|
||||
# SunOS
|
||||
elif [ "`uname`" == "SunOS" ]; then
|
||||
NODE_BIN="node-$NODE_VERSION-sunos-$ARCHITECTURE.exe"
|
||||
NODE_BIN="node-sunos-$ARCHITECTURE.exe"
|
||||
|
||||
else
|
||||
unsupported_platform
|
||||
|
@ -7,6 +7,7 @@
|
||||
"type": "git",
|
||||
"url": "git@bitbucket.org:rulemotion/resin-cli.git"
|
||||
},
|
||||
"bundled_engine": "v0.12.0",
|
||||
"preferGlobal": true,
|
||||
"man": [
|
||||
"./man/resin.1",
|
||||
|
@ -11,6 +11,7 @@ function parse_json() {
|
||||
PACKAGE_JSON=`cat package.json`
|
||||
VERSION=$(parse_json "$PACKAGE_JSON" version)
|
||||
NAME=$(parse_json "$PACKAGE_JSON" name)
|
||||
NODE_VERSION=$(parse_json "$PACKAGE_JSON" bundled_engine)
|
||||
|
||||
function print_banner() {
|
||||
local message=$1
|
||||
@ -26,9 +27,10 @@ function download_node() {
|
||||
local version=$3
|
||||
local output=$4
|
||||
|
||||
local package="node-$version-$os-$arch"
|
||||
local remote_package="node-$version-$os-$arch"
|
||||
local package="node-$os-$arch"
|
||||
|
||||
print_banner "Downloading $package"
|
||||
print_banner "Downloading $remote_package"
|
||||
|
||||
mkdir -p $output
|
||||
|
||||
@ -39,9 +41,9 @@ function download_node() {
|
||||
$CURL $NODE_DIST_URL/$version/$arch/node.exe -o $output/$package.exe
|
||||
fi
|
||||
else
|
||||
$CURL $NODE_DIST_URL/$version/$package.tar.gz | tar xz -C $output/
|
||||
cp $output/$package/bin/node $output/$package.bin
|
||||
rm -rf $output/$package
|
||||
$CURL $NODE_DIST_URL/$version/$remote_package.tar.gz | tar xz -C $output/
|
||||
cp $output/$remote_package/bin/node $output/$package.bin
|
||||
rm -rf $output/$remote_package
|
||||
fi
|
||||
}
|
||||
|
||||
@ -59,7 +61,7 @@ function distribute() {
|
||||
cp -vrf lib build/$package
|
||||
cp -vrf package.json build/$package
|
||||
|
||||
download_node $os $arch v0.12.0 build/$package/bin/node
|
||||
download_node $os $arch $NODE_VERSION build/$package/bin/node
|
||||
|
||||
print_banner "Running npm install"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user