Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(maker): add the rpm maker for the linux target
  • Loading branch information
malept committed Dec 4, 2016
1 parent 20ae889 commit 85821f2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,11 @@ os:
- linux
- osx

addons:
apt:
packages:
- rpm

env:
matrix:
- NODE_INSTALLER=npm
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -82,6 +82,7 @@
}
},
"optionalDependencies": {
"electron-installer-debian": "^0.4.0"
"electron-installer-debian": "^0.4.0",
"electron-installer-redhat": "^0.3.0"
}
}
33 changes: 33 additions & 0 deletions src/makers/linux/rpm.js
@@ -0,0 +1,33 @@
import installer from 'electron-installer-redhat';
import path from 'path';
import pify from 'pify';

import { ensureFile } from '../../util/ensure-output';

function rpmArch(nodeArch) {
switch (nodeArch) {
case 'ia32': return 'i386';
case 'x64': return 'x86_64';
case 'arm':
if (process.config.variables.arm_version === '7') {
return 'armv7hl';
}
return 'armv6hl';
default: return nodeArch;
}
}

export default async (dir, appName, forgeConfig, packageJSON) => { // eslint-disable-line
const arch = rpmArch(process.arch);
const outPath = path.resolve(dir, '../make', `${packageJSON.name}_${packageJSON.version}_${arch}.rpm`);

await ensureFile(outPath);
const rpmDefaults = {
arch,
dest: path.dirname(outPath),
src: dir,
};
const rpmConfig = Object.assign({}, forgeConfig.electronInstallerRedhat, rpmDefaults);

await pify(installer)(rpmConfig);
};

0 comments on commit 85821f2

Please sign in to comment.