packge all linux versions (#379)

This commit is contained in:
grunjol
2016-04-10 23:54:52 -03:00
committed by Feross Aboukhadijeh
parent c98f3cd040
commit e75cd45ec0
2 changed files with 36 additions and 32 deletions

View File

@@ -295,41 +295,45 @@ function buildLinux (packageType, cb) {
if (err) return cb(err) if (err) return cb(err)
var distPath = path.join(config.ROOT_PATH, 'dist') var distPath = path.join(config.ROOT_PATH, 'dist')
var filesPath = buildPath[0]
if (packageType === 'deb' || packageType === 'all') { for (var i = 0; i < buildPath.length; i++) {
// Create .deb file for debian based platforms var filesPath = buildPath[i]
var deb = require('nobin-debian-installer')() var destArch = filesPath.split('-').pop()
var destPath = path.join('/opt', pkg.name)
deb.pack({ if (packageType === 'deb' || packageType === 'all') {
package: pkg, // Create .deb file for debian based platforms
info: { var deb = require('nobin-debian-installer')()
arch: 'amd64', var destPath = path.join('/opt', pkg.name)
targetDir: distPath,
depends: 'libc6 (>= 2.4)', deb.pack({
scripts: { package: pkg,
postinst: path.join(config.STATIC_PATH, 'linux', 'postinst'), info: {
prerm: path.join(config.STATIC_PATH, 'linux', 'prerm') arch: destArch === 'x64' ? 'amd64' : 'i386',
targetDir: distPath,
depends: 'libc6 (>= 2.4)',
scripts: {
postinst: path.join(config.STATIC_PATH, 'linux', 'postinst'),
prerm: path.join(config.STATIC_PATH, 'linux', 'prerm')
}
} }
} }, [{
}, [{ src: ['./**'],
src: ['./**'], dest: destPath,
dest: destPath, expand: true,
expand: true, cwd: filesPath
cwd: filesPath }], function (err, done) {
}], function (err, done) { if (err) return console.error(err.message || err)
if (err) return console.error(err.message || err) console.log('Created Linux ' + destArch + ' .deb file.')
console.log('Created Linux .deb file.') })
}) }
}
if (packageType === 'zip' || packageType === 'all') { if (packageType === 'zip' || packageType === 'all') {
// Create .zip file for Linux // Create .zip file for Linux
var zipPath = path.join(config.ROOT_PATH, 'dist', BUILD_NAME + '-linux.zip') var zipPath = path.join(config.ROOT_PATH, 'dist', BUILD_NAME + '-linux-' + destArch + '.zip')
var appFolderName = path.basename(filesPath) var appFolderName = path.basename(filesPath)
cp.execSync(`cd ${distPath} && zip -r -y ${zipPath} ${appFolderName}`) cp.execSync(`cd ${distPath} && zip -r -y ${zipPath} ${appFolderName}`)
console.log('Created Linux .zip file.') console.log('Created Linux ' + destArch + ' .zip file.')
}
} }
}) })
} }

View File

@@ -46,7 +46,7 @@
"electron-packager": "electron-userland/electron-packager", "electron-packager": "electron-userland/electron-packager",
"electron-winstaller": "feross/windows-installer#build", "electron-winstaller": "feross/windows-installer#build",
"gh-release": "^2.0.3", "gh-release": "^2.0.3",
"nobin-debian-installer": "^0.0.8", "nobin-debian-installer": "^0.0.9",
"plist": "^1.2.0", "plist": "^1.2.0",
"standard": "^6.0.5" "standard": "^6.0.5"
}, },