|
|
@ -1,7 +1,8 @@ |
|
|
|
var fs = require('fs'), |
|
|
|
path = require('path'), |
|
|
|
exec = require('child_process').exec, |
|
|
|
cmd = process.argv[2]; |
|
|
|
cmd = process.argv[2], |
|
|
|
dest_dir = process.argv[3] || ''; |
|
|
|
|
|
|
|
if (cmd !== 'install' && cmd !== 'uninstall') { |
|
|
|
console.error('Unknown command: ' + cmd); |
|
|
@ -26,7 +27,7 @@ function copy(src, dst, callback) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
dst = path.join(node_prefix, dst); |
|
|
|
dst = path.join(dest_dir, node_prefix, dst); |
|
|
|
var dir = dst.replace(/\/[^\/]*$/, '/'); |
|
|
|
|
|
|
|
// Create directory if hasn't done this yet
|
|
|
@ -42,7 +43,7 @@ function copy(src, dst, callback) { |
|
|
|
// Remove files
|
|
|
|
function remove(files) { |
|
|
|
files.forEach(function(file) { |
|
|
|
file = path.join(node_prefix, file); |
|
|
|
file = path.join(dest_dir, node_prefix, file); |
|
|
|
queue.push('rm -rf ' + file); |
|
|
|
}); |
|
|
|
} |
|
|
@ -127,9 +128,10 @@ if (cmd === 'install') { |
|
|
|
if (variables.node_install_npm) { |
|
|
|
copy('deps/npm', 'lib/node_modules/npm'); |
|
|
|
queue.push('ln -sf ../lib/node_modules/npm/bin/npm-cli.js ' + |
|
|
|
path.join(node_prefix, 'bin/npm')); |
|
|
|
path.join(dest_dir, node_prefix, 'bin/npm')); |
|
|
|
queue.push([shebang, '#!' + path.join(node_prefix, 'bin/node'), |
|
|
|
path.join(node_prefix, 'lib/node_modules/npm/bin/npm-cli.js')]); |
|
|
|
path.join(dest_dir, node_prefix, |
|
|
|
'lib/node_modules/npm/bin/npm-cli.js')]); |
|
|
|
} |
|
|
|
} else { |
|
|
|
remove([ |
|
|
|