Windows installer

This commit is contained in:
Jeffrey Morgan 2015-06-04 19:25:22 -07:00
parent 94113feaed
commit 47967507dc
5 changed files with 18 additions and 19 deletions

View File

@ -41,7 +41,11 @@ var _steps = [{
yield virtualBox.killall();
progressCallback(50); // TODO: detect when the installation has started so we can simulate progress
try {
yield util.exec(setupUtil.macSudoCmd(setupUtil.installVirtualBoxCmd()));
if (util.isWindows()) {
yield util.exec([path.join(util.supportDir(), virtualBox.filename())]);
} else {
yield util.exec(setupUtil.macSudoCmd(setupUtil.installVirtualBoxCmd()));
}
} catch (err) {
throw null;
}

View File

@ -57,7 +57,11 @@ var DockerMachine = {
},
create: function () {
var dockerversion = util.packagejson()['docker-version'];
return util.exec([this.command(), '-D', 'create', '-d', 'virtualbox', '--virtualbox-boot2docker-url', path.join(process.cwd(), 'resources', 'boot2docker-' + dockerversion + '.iso'), '--virtualbox-memory', '2048', NAME]);
if (util.isWindows()) {
return util.exec([this.command(), '-D', 'create', '-d', 'virtualbox', '--virtualbox-memory', '2048', NAME]);
} else {
return util.exec([this.command(), '-D', 'create', '-d', 'virtualbox', '--virtualbox-boot2docker-url', path.join(process.cwd(), 'resources', 'boot2docker-' + dockerversion + '.iso'), '--virtualbox-memory', '2048', NAME]);
}
},
start: function () {
return util.exec([this.command(), '-D', 'start', NAME]);

View File

@ -170,6 +170,8 @@ export default {
localStorage.setItem('placeholders', JSON.stringify(this.placeholders));
this.pullImage(repository, tag, error => {
delete this.placeholders[name];
localStorage.setItem('placeholders', JSON.stringify(this.placeholders));
if (error) {
containerServerActions.error({name, error});
return;
@ -179,8 +181,6 @@ export default {
return;
}
delete this.placeholders[name];
localStorage.setItem('placeholders', JSON.stringify(this.placeholders));
this.createContainer(name, {Image: imageName});
},
@ -374,6 +374,7 @@ export default {
var data = JSON.parse(str);
if (data.error) {
console.log(data.error);
callback(data.error);
return;
}

View File

@ -3,6 +3,8 @@ var Promise = require('bluebird');
var fs = require('fs');
var path = require('path');
var crypto = require('crypto');
var remote = require('remote');
var app = remote.require('app');
module.exports = {
exec: function (args, options) {
@ -37,18 +39,10 @@ module.exports = {
return str.replace(/ /g, '\\ ').replace(/\(/g, '\\(').replace(/\)/g, '\\)');
},
home: function () {
return process.env[this.isWindows() ? 'USERPROFILE' : 'HOME'];
return app.getPath('home');
},
supportDir: function () {
var dirs = ['Library', 'Application\ Support', 'Kitematic'];
var acc = this.home();
dirs.forEach(function (d) {
acc = path.join(acc, d);
if (!fs.existsSync(acc)) {
fs.mkdirSync(acc);
}
});
return acc;
return app.getPath('userData');
},
CommandOrCtrl: function () {
return this.isWindows() ? 'Ctrl' : 'Command';

View File

@ -17,11 +17,7 @@ var VirtualBox = {
return util.isWindows() ? util.packagejson()['virtualbox-checksum-win'] : util.packagejson()['virtualbox-checksum'];
},
url: function () {
if(util.isWindows()) {
return 'http://download.virtualbox.org/virtualbox/4.3.26/VirtualBox-4.3.26-98988-Win.exe';
} else {
return `https://github.com/kitematic/virtualbox/releases/download/${util.packagejson()['virtualbox-version']}/${this.filename()}`;
}
return `https://github.com/kitematic/virtualbox/releases/download/${util.packagejson()['virtualbox-version']}/${this.filename()}`;
},
installed: function () {
if(util.isWindows()) {