Lower virtual box req. Fix upgrade

This commit is contained in:
Jeffrey Morgan 2015-02-24 19:32:22 -05:00
Родитель 6223df9ae4
Коммит 0a033e807b
10 изменённых файлов: 19 добавлений и 33 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -1,4 +1,5 @@
.DS_Store
.swp
build
dist
node_modules

Просмотреть файл

@ -6,14 +6,6 @@ var util = require('../src/Util');
var Promise = require('bluebird');
describe('Boot2Docker', () => {
pit('cli version is parsed correctly', function () {
util.exec.mockReturnValueOnce(Promise.resolve('Boot2Docker-cli version: v1.4.1\nGit commit: 43241cb'));
return boot2docker.cliversion().then(version => {
expect(util.exec).toBeCalledWith([boot2docker.command(), 'version']);
expect(version).toBe('1.4.1');
});
});
it('iso version parsed correctly', function () {
fs.readFileSync.mockReturnValueOnce('9adjaldijaslkjd123Boot2Docker-v1.4.1aisudhha82jj123');
expect(boot2docker.isoversion()).toBe('1.4.1');

Просмотреть файл

@ -4,10 +4,10 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
sudo rm -f /usr/local/bin/docker
sudo rm -f /usr/local/bin/boot2docker
pkill VirtualBox
pkill VBox
rm -rf ~/Library/Application\ Support/Kitematic/
rm -rf ~/.boot2docker
rm -rf ~/VirtualBox\ VMs/boot2docker-vm
rm -rf ~/Library/VirtualBox/
pkill VBox
pkill VirtualBox
$DIR/VirtualBox_Uninstall.tool

Просмотреть файл

@ -45,7 +45,7 @@
"virtualbox-version": "4.3.22",
"virtualbox-filename": "VirtualBox-4.3.22.pkg",
"virtualbox-checksum": "4a7dff25bdeef0d112e16ac11bee6d52e856d36bb412aa75576036ba560082eb",
"virtualbox-required-version": "4.3.12",
"virtualbox-required-version": "4.3.0",
"dependencies": {
"ansi-to-html": "0.2.0",
"async": "^0.9.0",

Просмотреть файл

@ -16,18 +16,6 @@ var Boot2Docker = {
return null;
}
},
cliversion: function () {
return util.exec([Boot2Docker.command(), 'version']).then(stdout => {
var match = stdout.match(/version: v(\d+\.\d+\.\d+)/);
if (!match || match.length < 2) {
return Promise.reject('Could not parse the boot2docker cli version.');
} else {
return Promise.resolve(match[1]);
}
}).catch(err => {
return Promise.reject(err);
});
},
isoversion: function () {
try {
var data = fs.readFileSync(path.join(util.home(), '.boot2docker', 'boot2docker.iso'), 'utf8');

Просмотреть файл

@ -83,10 +83,10 @@ var Setup = React.createClass({
</div>
<div className="desc">
<div className="content">
<h4>Installation Cancelled</h4>
<h1>Couldn&#39;t Install</h1>
<h4>Setup Cancelled</h4>
<h1>Couldn&#39;t Install Requirements</h1>
<p>Kitematic didn&#39;t receive the administrative privileges required to install or upgrade VirtualBox &amp; Docker.</p>
<p>Please retry or download &amp; install VirutalBox manually from the <a onClick={this.handleOpenWebsite}>official Oracle website</a>.</p>
<p>Please click retry. If VirtualBox is not installed, you can download &amp; install it manually from the <a onClick={this.handleOpenWebsite}>official Oracle website</a>.</p>
<button className="btn btn-action" onClick={this.handleRetry}>Retry</button>
</div>
</div>
@ -106,7 +106,7 @@ var Setup = React.createClass({
</div>
<div className="desc">
<div className="content">
<h4>Installation Error</h4>
<h4>Setup Error</h4>
<h1>We&#39;re Sorry!</h1>
<p>There seems to have been an unexpected error with Kitematic:</p>
<p className="error">{this.state.error}<br />{this.state.error.message}</p>

Просмотреть файл

@ -143,8 +143,9 @@ var SetupStore = assign(Object.create(EventEmitter.prototype), {
var isoversion = boot2docker.isoversion();
var required = {};
var vboxfile = path.join(util.supportDir(), packagejson['virtualbox-filename']);
required.download = !virtualBox.installed() && (!fs.existsSync(vboxfile) || setupUtil.checksum(vboxfile) !== packagejson['virtualbox-checksum']);
required.install = !virtualBox.installed() || setupUtil.needsBinaryFix() || setupUtil.compareVersions(yield virtualBox.version(), packagejson['virtualbox-required-version']) < 0;
var vboxUpgradeRequired = setupUtil.compareVersions(yield virtualBox.version(), packagejson['virtualbox-required-version']) < 0;
required.download = vboxUpgradeRequired || !virtualBox.installed() && (!fs.existsSync(vboxfile) || setupUtil.checksum(vboxfile) !== packagejson['virtualbox-checksum']);
required.install = vboxUpgradeRequired || !virtualBox.installed() || setupUtil.needsBinaryFix();
required.init = !(yield boot2docker.exists()) || !isoversion || setupUtil.compareVersions(isoversion, boot2docker.version()) < 0;
required.start = required.install || required.init || (yield boot2docker.status()) !== 'running';

Просмотреть файл

@ -9,6 +9,9 @@ var util = require('./Util');
var SetupUtil = {
needsBinaryFix: function () {
if (!fs.existsSync('/usr/local') || !fs.existsSync('/usr/local/bin')) {
return true;
}
if (!fs.existsSync('/usr/local/bin/docker') && !fs.existsSync('/usr/local/bin/boot2docker')) {
return fs.statSync('/usr/local/bin').gid !== 80 || fs.statSync('/usr/local/bin').uid !== process.getuid();
}

Просмотреть файл

@ -40,7 +40,8 @@ module.exports = {
},
copyBinariesCmd: function () {
var packagejson = this.packagejson();
var cmd = [];
var cmd = ['mkdir', '-p', '/usr/local/bin'];
cmd.push('&&');
cmd.push.apply(cmd, this.copycmd(this.escapePath(path.join(this.resourceDir(), 'boot2docker-' + packagejson['boot2docker-version'])), '/usr/local/bin/boot2docker'));
cmd.push('&&');
cmd.push.apply(cmd, this.copycmd(this.escapePath(path.join(this.resourceDir(), 'docker-' + packagejson['docker-version'])), '/usr/local/bin/docker'));

Просмотреть файл

@ -20,14 +20,14 @@ var VirtualBox = {
}).catch(reject);
});
},
poweroffall: function () {
saveall: function () {
if (!this.installed()) {
return Promise.reject('VirtualBox not installed.');
}
return util.exec(this.command() + ' list runningvms | sed -E \'s/.*\\{(.*)\\}/\\1/\' | xargs -L1 -I {} ' + this.command() + ' controlvm {} poweroff');
return util.exec(this.command() + ' list runningvms | sed -E \'s/.*\\{(.*)\\}/\\1/\' | xargs -L1 -I {} ' + this.command() + ' controlvm {} savestate');
},
killall: function () {
return this.poweroffall().then(() => {
return this.saveall().then(() => {
return util.exec(['pkill', 'VirtualBox']);
}).then(() => {
return util.exec(['pkill', 'VBox']);