Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/runtime-qemu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

var argv = require('minimist')(process.argv.slice(2), {
boolean: ['kvm', 'verbose', 'nographic', 'dry-run', 'netdump', 'curses', 'virtio-rng']
boolean: ['kvm', 'verbose', 'nographic', 'dry-run', 'netdump', 'curses', 'virtio-rng', 'local']
});
var shell = require('shelljs');
var qemu = require('../qemu');
Expand Down Expand Up @@ -54,6 +54,7 @@ if (!command) {
shell.echo(' --virtio-rng Enable VIRTIO-RNG entropy source for the runtime.js');
shell.echo(' --nographic Disable graphics');
shell.echo(' --kernel=<kernel> Specify local kernel file to use');
shell.echo(' --local Download the kernel locally (i.e. in the module\'s directory)');
shell.echo(' --kernelver=<ver> Specify kernel version to download (defaults to latest)');
shell.echo('');
shell.echo(' --print-log Show log file written in curses mode (using less)');
Expand Down Expand Up @@ -95,7 +96,7 @@ var qemuVirtioRng = !!argv['virtio-rng'];
var dryRun = !!argv['dry-run'];
var verbose = !!argv.verbose;

getRuntime(kernelVer, kernelFile, function(err, runtimeFile) {
getRuntime(kernelVer, kernelFile, !!argv.local, function(err, runtimeFile) {
if (err) {
throw err;
}
Expand Down
5 changes: 3 additions & 2 deletions get-prebuilt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ var nugget = require('nugget');
var shell = require('shelljs');
var path = require('path');

module.exports = function(kernelVersion, cb) {
var kernelsDir = path.resolve(__dirname, 'runtimejs-kernels');
module.exports = function(kernelVersion, shouldBeLocal, cb) {
var basePath = shouldBeLocal ? __dirname : process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
var kernelsDir = path.resolve(basePath, '.runtime');
if (!shell.test('-d', kernelsDir)) {
shell.mkdir(kernelsDir);
}
Expand Down
4 changes: 2 additions & 2 deletions get-runtime.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var getPrebuilt = require('./get-prebuilt');

module.exports = function(kernelVer, kernelFile, cb) {
module.exports = function(kernelVer, kernelFile, shouldBeLocal, cb) {
if (!kernelFile) {
return getPrebuilt(kernelVer, cb);
return getPrebuilt(kernelVer, shouldBeLocal, cb);
} else {
return cb(null, kernelFile);
}
Expand Down