chroot.js | |
---|---|
var path = require('path'),
exec = require('child_process').exec,
npm = require('npm'),
haibu = require('../../haibu');
var chroot = exports; | |
Name this plugin so it can be accessed by name | chroot.name = 'chroot'; |
function init (options, callback)@options {Object} Options to initialize this plugin with@callback {function} Continuation to respond to when completeInitalizes the | chroot.init = function (options, callback) {
options = options || {};
callback = callback || function () { };
var root = options.root || '/srv/chroot/lucid_amd64',
source = options.source || '/usr/local/src',
relativeSource = path.join(root, source);
|
Add the configuration necessary for chroot plugin | haibu.config.set('chroot', {
enabled: true,
root: root,
source: source
});
haibu.config.set('directories:apps', relativeSource);
haibu.utils.initDirectories({ chroot: relativeSource }, callback);
}; |
function argv (repo)@repo {Repository} Code repository we are spawning fromReturns the appropriate spawn options for the | chroot.argv = function (repo) { |
e.g. /usr/local/src within the chroot. | var root = haibu.config.get('chroot:root'),
sourceDir = haibu.config.get('chroot:source');
return {
script: repo.startScript.replace(root, ''),
argv: [
'--plugin',
'chroot',
'--chroot',
haibu.config.get('chroot:root'),
'--plugin',
'chdir',
'--chdir',
repo.homeDir.replace(root, '')
]
};
};
|