Pass os/arch to install-node.js with env vars

This commit is contained in:
Juan Cruz Viotti 2015-02-24 16:28:10 -04:00
parent 9807bf308c
commit 7c53b35cbd
2 changed files with 15 additions and 8 deletions

View File

@ -4,11 +4,14 @@ var path = require('path');
var nodeVersion = require('../package.json').bundled_engine; var nodeVersion = require('../package.json').bundled_engine;
var destination = './bin/node'; var destination = './bin/node';
console.log('Downloading node-' + nodeVersion + '-' + process.platform + '-' + process.arch); var os = process.env.RESIN_OS || process.platform;
var arch = process.env.RESIN_ARCH || process.arch;
console.log('Downloading node-' + nodeVersion + '-' + os + '-' + arch);
binary.download({ binary.download({
os: process.platform, os: os,
arch: process.arch, arch: arch,
version: nodeVersion version: nodeVersion
}, destination, function(error, binaryPath) { }, destination, function(error, binaryPath) {
if(error) { if(error) {
@ -16,7 +19,7 @@ binary.download({
process.exit(1); process.exit(1);
} }
var output = path.join(destination, 'node-' + process.platform + '-' + process.arch); var output = path.join(destination, 'node-' + os + '-' + arch);
if(process.platform === 'win32') { if(process.platform === 'win32') {
output += '.exe'; output += '.exe';

View File

@ -27,14 +27,18 @@ function distribute() {
# Copy all needed files # Copy all needed files
mkdir -p build/$package mkdir -p build/$package
# TODO: Omit bin/node
cp -vrf bin build/$package cp -vrf bin build/$package
cp -vrf lib build/$package cp -vrf lib build/$package
cp -vrf package.json build/$package cp -vrf package.json build/$package
print_banner "Running npm install" print_banner "Running npm install"
cd build/$package cd build/$package
npm install --production --force
RESIN_OS=$os RESIN_ARCH=$arch npm install --production --force
# Leaving this enabled causes # Leaving this enabled causes
# Path too long issues in Windows. # Path too long issues in Windows.
@ -56,14 +60,14 @@ function distribute() {
cd .. cd ..
} }
distribute "darwin" "x64" # distribute "darwin" "x64"
# distribute "darwin" "x86" # distribute "darwin" "x86"
# distribute "linux" "x64" # distribute "linux" "x64"
# distribute "linux" "x86" # distribute "linux" "x86"
# distribute "win32" "x64" distribute "win32" "x64"
# distribute "win32" "x86" distribute "win32" "x86"
# distribute "sunos" "x64" # distribute "sunos" "x64"
# distribute "sunos" "x86" # distribute "sunos" "x86"