Commit a6d2e2f6 authored by 1dot75cm's avatar 1dot75cm

create rpm package

parent f74b8254
Name: {{name}}
Version: v{{version}}
Release: linux
Summary: {{description}}
Group: Applications/Communications
Vendor: Rocket.Chat Community
Packager: {{author}}
License: MIT
URL: https://rocket.chat/
AutoReq: 0
%description
{{description}}
%install
mkdir -p %{buildroot}/opt/{{name}}
cp -r opt/{{name}}/* %{buildroot}/opt/{{name}}
mkdir -p %{buildroot}/usr/bin
cat > %{buildroot}/usr/bin/{{name}} <<EOF
#!/bin/bash
/opt/{{name}}/{{name}}
EOF
mkdir -p %{buildroot}/usr/share/applications
cp -r usr/share/applications/{{name}}.desktop \
%{buildroot}/usr/share/applications
%files
%defattr(-,root,root,-)
/opt/{{name}}/
%attr(755,root,root) /usr/bin/{{name}}
/usr/share/applications/{{name}}.desktop
......@@ -104,6 +104,45 @@ var packToDebFile = function () {
return deferred.promise;
};
var packToRpmFile = function () {
var deferred = Q.defer();
var rpmFileName = packName + '.rpm';
var rpmPath = releasesDir.path(rpmFileName);
gulpUtil.log('Creating RPM package... (' + rpmFileName + ')');
// Preparing RPM Spec file
var spec = projectDir.read('resources/linux/RHEL/app.spec');
spec = utils.replace(spec, {
name: manifest.name,
description: manifest.description,
version: manifest.version,
author: manifest.author,
});
tmpDir.write('SPECS/app.spec', spec);
// Build the package...
childProcess.exec('fakeroot rpmbuild --quiet -D "_topdir `pwd`/tmp" -D "_builddir ' + packDir.path() + '" -bb ' + tmpDir.path('SPECS/app.spec').replace(/\s/g, '\\ '),
function (error, stdout, stderr) {
if (error || stderr) {
console.log('ERROR while building RPM package:');
console.log(error);
console.log(stderr);
} else {
// Copy to release directory
tmpDir.copy('RPMS/x86_64', releasesDir.path(), {
matching: '*.rpm',
overwrite: true
});
gulpUtil.log('RPM package ready!', rpmPath);
}
deferred.resolve();
});
return deferred.promise;
};
var cleanClutter = function () {
return tmpDir.removeAsync('.');
};
......@@ -115,6 +154,7 @@ module.exports = function () {
.then(finalize)
.then(renameApp)
.then(packToDebFile)
.then(packToRpmFile)
.then(cleanClutter)
.catch(console.error);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment