mirror of https://github.com/docker/docs.git
Merge pull request #1677 from adomenech73/ubuntu-installer
Initial Linux installer 🎉 - Default to Debian build
This commit is contained in:
commit
745cfa0537
149
Gruntfile.js
149
Gruntfile.js
|
|
@ -1,3 +1,4 @@
|
||||||
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var execFile = require('child_process').execFile;
|
var execFile = require('child_process').execFile;
|
||||||
var packagejson = require('./package.json');
|
var packagejson = require('./package.json');
|
||||||
|
|
@ -26,11 +27,20 @@ module.exports = function (grunt) {
|
||||||
var OSX_OUT = './dist';
|
var OSX_OUT = './dist';
|
||||||
var OSX_OUT_X64 = OSX_OUT + '/' + OSX_APPNAME + '-darwin-x64';
|
var OSX_OUT_X64 = OSX_OUT + '/' + OSX_APPNAME + '-darwin-x64';
|
||||||
var OSX_FILENAME = OSX_OUT_X64 + '/' + OSX_APPNAME + '.app';
|
var OSX_FILENAME = OSX_OUT_X64 + '/' + OSX_APPNAME + '.app';
|
||||||
|
|
||||||
var IS_WINDOWS = process.platform === 'win32';
|
var IS_WINDOWS = process.platform === 'win32';
|
||||||
|
var IS_LINUX = process.platform === 'linux';
|
||||||
|
|
||||||
|
var IS_I386 = process.arch === 'ia32';
|
||||||
|
var IS_X64 = process.arch === 'x64';
|
||||||
|
|
||||||
|
var IS_DEB = fs.existsSync('/etc/lsb-release') || fs.existsSync('/etc/debian_version');
|
||||||
|
var IS_RPM = fs.existsSync('/etc/redhat-release');
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
IDENTITY: 'Developer ID Application: Docker Inc',
|
IDENTITY: 'Developer ID Application: Docker Inc',
|
||||||
OSX_FILENAME: OSX_FILENAME,
|
OSX_FILENAME: OSX_FILENAME,
|
||||||
OSX_FILENAME_ESCAPED: OSX_FILENAME.replace(/ /g, '\\ ').replace(/\(/g,'\\(').replace(/\)/g,'\\)'),
|
OSX_FILENAME_ESCAPED: OSX_FILENAME.replace(/ /g, '\\ ').replace(/\(/g, '\\(').replace(/\)/g, '\\)'),
|
||||||
|
|
||||||
// electron
|
// electron
|
||||||
electron: {
|
electron: {
|
||||||
|
|
@ -117,7 +127,9 @@ module.exports = function (grunt) {
|
||||||
dest: 'build/'
|
dest: 'build/'
|
||||||
}, {
|
}, {
|
||||||
cwd: 'node_modules/',
|
cwd: 'node_modules/',
|
||||||
src: Object.keys(packagejson.dependencies).map(function (dep) { return dep + '/**/*';}),
|
src: Object.keys(packagejson.dependencies).map(function (dep) {
|
||||||
|
return dep + '/**/*';
|
||||||
|
}),
|
||||||
dest: 'build/node_modules/',
|
dest: 'build/node_modules/',
|
||||||
expand: true
|
expand: true
|
||||||
}]
|
}]
|
||||||
|
|
@ -181,7 +193,7 @@ module.exports = function (grunt) {
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: 'src/',
|
cwd: 'src/',
|
||||||
src: ['**/*.js'],
|
src: ['**/*.js'],
|
||||||
dest: 'build/',
|
dest: 'build/'
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -198,22 +210,25 @@ module.exports = function (grunt) {
|
||||||
},
|
},
|
||||||
sign: {
|
sign: {
|
||||||
options: {
|
options: {
|
||||||
failOnError: false,
|
failOnError: false
|
||||||
},
|
},
|
||||||
command: [
|
command: [
|
||||||
'codesign --deep -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>/Contents/Frameworks/*',
|
'codesign --deep -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>/Contents/Frameworks/*',
|
||||||
'codesign -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>',
|
'codesign -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>',
|
||||||
'codesign -vvv --display <%= OSX_FILENAME_ESCAPED %>',
|
'codesign -vvv --display <%= OSX_FILENAME_ESCAPED %>',
|
||||||
'codesign -v --verify <%= OSX_FILENAME_ESCAPED %>'
|
'codesign -v --verify <%= OSX_FILENAME_ESCAPED %>'
|
||||||
].join(' && '),
|
].join(' && ')
|
||||||
},
|
},
|
||||||
zip: {
|
zip: {
|
||||||
command: 'ditto -c -k --sequesterRsrc --keepParent <%= OSX_FILENAME_ESCAPED %> release/' + BASENAME + '-Mac.zip',
|
command: 'ditto -c -k --sequesterRsrc --keepParent <%= OSX_FILENAME_ESCAPED %> release/' + BASENAME + '-Mac.zip'
|
||||||
|
},
|
||||||
|
linux_npm: {
|
||||||
|
command: 'cd build && npm install --production'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clean: {
|
clean: {
|
||||||
release: ['build/', 'dist/'],
|
release: ['build/', 'dist/']
|
||||||
},
|
},
|
||||||
|
|
||||||
compress: {
|
compress: {
|
||||||
|
|
@ -228,7 +243,7 @@ module.exports = function (grunt) {
|
||||||
cwd: './dist/Kitematic-win32-x64',
|
cwd: './dist/Kitematic-win32-x64',
|
||||||
src: '**/*'
|
src: '**/*'
|
||||||
}]
|
}]
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// livereload
|
// livereload
|
||||||
|
|
@ -252,12 +267,126 @@ module.exports = function (grunt) {
|
||||||
files: ['images/*', 'index.html', 'fonts/*'],
|
files: ['images/*', 'index.html', 'fonts/*'],
|
||||||
tasks: ['newer:copy:dev']
|
tasks: ['newer:copy:dev']
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'electron-packager': {
|
||||||
|
build: {
|
||||||
|
options: {
|
||||||
|
platform: process.platform,
|
||||||
|
arch: process.arch,
|
||||||
|
dir: './build',
|
||||||
|
out: './dist/',
|
||||||
|
name: 'Kitematic',
|
||||||
|
ignore: 'bower.json',
|
||||||
|
version: packagejson['electron-version'], // set version of electron
|
||||||
|
overwrite: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
osxlnx: {
|
||||||
|
options: {
|
||||||
|
platform: 'linux',
|
||||||
|
arch: 'x64',
|
||||||
|
dir: './build',
|
||||||
|
out: './dist/',
|
||||||
|
name: 'Kitematic',
|
||||||
|
ignore: 'bower.json',
|
||||||
|
version: packagejson['electron-version'], // set version of electron
|
||||||
|
overwrite: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'electron-installer-debian': {
|
||||||
|
options: {
|
||||||
|
productName: LINUX_APPNAME,
|
||||||
|
productDescription: 'Run containers through a simple, yet powerful graphical user interface.',
|
||||||
|
section: 'devel',
|
||||||
|
priority: 'optional',
|
||||||
|
icon: './util/kitematic.png',
|
||||||
|
lintianOverrides: [
|
||||||
|
'changelog-file-missing-in-native-package',
|
||||||
|
'executable-not-elf-or-script',
|
||||||
|
'extra-license-file'
|
||||||
|
],
|
||||||
|
categories: [
|
||||||
|
'Utility'
|
||||||
|
],
|
||||||
|
rename: function (dest, src) {
|
||||||
|
return dest + '<%= name %>_' + packagejson.version + '-<%= revision %>_<%= arch %>.deb';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
linux64: {
|
||||||
|
options: {
|
||||||
|
arch: 'amd64'
|
||||||
|
},
|
||||||
|
src: './dist/Kitematic-linux-x64/',
|
||||||
|
dest: './dist/'
|
||||||
|
},
|
||||||
|
linux32: {
|
||||||
|
options: {
|
||||||
|
arch: 'i386'
|
||||||
|
},
|
||||||
|
src: './dist/Kitematic-linux-ia32/',
|
||||||
|
dest: './dist/'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'electron-installer-redhat': {
|
||||||
|
options: {
|
||||||
|
productName: LINUX_APPNAME,
|
||||||
|
productDescription: 'Run containers through a simple, yet powerful graphical user interface.',
|
||||||
|
priority: 'optional',
|
||||||
|
icon: './util/kitematic.png',
|
||||||
|
categories: [
|
||||||
|
'Utilities'
|
||||||
|
],
|
||||||
|
rename: function (dest, src) {
|
||||||
|
return dest + '<%= name %>_' + packagejson.version + '-<%= revision %>_<%= arch %>.rpm';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
linux64: {
|
||||||
|
options: {
|
||||||
|
arch: 'x86_64'
|
||||||
|
},
|
||||||
|
src: './dist/Kitematic-linux-x64/',
|
||||||
|
dest: './dist/'
|
||||||
|
},
|
||||||
|
linux32: {
|
||||||
|
options: {
|
||||||
|
arch: 'x86'
|
||||||
|
},
|
||||||
|
src: './dist/Kitematic-linux-ia32/',
|
||||||
|
dest: './dist/'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Load the plugins for linux packaging
|
||||||
|
grunt.loadNpmTasks('grunt-electron-packager');
|
||||||
|
grunt.loadNpmTasks('grunt-electron-installer-debian');
|
||||||
|
grunt.loadNpmTasks('grunt-electron-installer-redhat');
|
||||||
|
|
||||||
grunt.registerTask('default', ['newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']);
|
grunt.registerTask('default', ['newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']);
|
||||||
if (!IS_WINDOWS) {
|
|
||||||
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron', 'copy:osx', 'shell:sign', 'shell:zip', 'copy:windows', 'rcedit:exes', 'compress']);
|
if (!IS_WINDOWS && !IS_LINUX) {
|
||||||
|
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron', 'copy:osx', 'shell:sign', 'shell:zip', 'copy:windows', 'rcedit:exes', 'compress', 'shell:linux_npm', 'electron-packager:osxlnx', 'electron-installer-debian:linux64']);
|
||||||
|
}else if (IS_LINUX) {
|
||||||
|
|
||||||
|
var linuxpackage = null;
|
||||||
|
// linux package detection
|
||||||
|
if (IS_DEB && IS_X64) {
|
||||||
|
linuxpackage = 'electron-installer-debian:linux64';
|
||||||
|
} else if (IS_DEB && IS_I386) {
|
||||||
|
linuxpackage = 'electron-installer-debian:linux32';
|
||||||
|
} else if (IS_RPM && IS_X64) {
|
||||||
|
linuxpackage = 'electron-installer-redhat:linux64';
|
||||||
|
}else if (IS_RPM && IS_I386) {
|
||||||
|
linuxpackage = 'electron-installer-redhat:linux32';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (linuxpackage) {
|
||||||
|
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'shell:linux_npm', 'electron-packager:build', linuxpackage]);
|
||||||
|
}else {
|
||||||
|
grunt.log.errorlns('Your Linux distribution is not yet supported - arch:' + process.arch + ' platform:' + process.platform);
|
||||||
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'compress']);
|
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'compress']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,9 @@
|
||||||
"grunt-download-electron": "^2.1.1",
|
"grunt-download-electron": "^2.1.1",
|
||||||
"grunt-electron": "^2.0.0",
|
"grunt-electron": "^2.0.0",
|
||||||
"grunt-electron-installer": "^1.0.4",
|
"grunt-electron-installer": "^1.0.4",
|
||||||
|
"grunt-electron-installer-debian": "^0.3.0",
|
||||||
|
"grunt-electron-installer-redhat": "^0.3.0",
|
||||||
|
"grunt-electron-packager": "0.0.7",
|
||||||
"grunt-if-missing": "^1.0.0",
|
"grunt-if-missing": "^1.0.0",
|
||||||
"grunt-newer": "^1.1.1",
|
"grunt-newer": "^1.1.1",
|
||||||
"grunt-plistbuddy": "^0.1.1",
|
"grunt-plistbuddy": "^0.1.1",
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
Loading…
Reference in New Issue