From b5c6d76999deb5309fd318c5544cb0bdac6eccf8 Mon Sep 17 00:00:00 2001 From: Ardeshir Javaherchi Date: Sat, 11 Oct 2014 17:04:14 -0700 Subject: [PATCH 1/3] Add grunt mkrpm task to create rpm package --- build/Gruntfile.coffee | 1 + build/tasks/mkrpm-task.coffee | 44 +++++++++++++++++++++++++++++ resources/linux/redhat/atom.spec.in | 29 +++++++++++++++++++ script/mkrpm | 19 +++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 build/tasks/mkrpm-task.coffee create mode 100644 resources/linux/redhat/atom.spec.in create mode 100755 script/mkrpm diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index e7ccf30ed..c57563fd9 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -234,6 +234,7 @@ module.exports = (grunt) -> ciTasks.push('dump-symbols') if process.platform isnt 'win32' ciTasks.push('set-version', 'check-licenses', 'lint') ciTasks.push('mkdeb') if process.platform is 'linux' + ciTasks.push('mkrpm') if process.platform is 'linux' ciTasks.push('test') if process.platform is 'darwin' ciTasks.push('codesign') ciTasks.push('publish-build') diff --git a/build/tasks/mkrpm-task.coffee b/build/tasks/mkrpm-task.coffee new file mode 100644 index 000000000..69fdffbd1 --- /dev/null +++ b/build/tasks/mkrpm-task.coffee @@ -0,0 +1,44 @@ +fs = require 'fs' +path = require 'path' +_ = require 'underscore-plus' + +module.exports = (grunt) -> + {spawn} = require('./task-helpers')(grunt) + + fillTemplate = (filePath, data) -> + template = _.template(String(fs.readFileSync("#{filePath}.in"))) + filled = template(data) + + outputPath = path.join(grunt.config.get('atom.buildDir'), path.basename(filePath)) + grunt.file.write(outputPath, filled) + outputPath + + grunt.registerTask 'mkrpm', 'Create rpm package', -> + done = @async() + + if process.arch is 'ia32' + arch = 'i386' + else if process.arch is 'x64' + arch = 'amd64' + else + return done("Unsupported arch #{process.arch}") + + {name, version, description} = grunt.file.readJSON('package.json') + section = 'devel' + maintainer = 'GitHub ' + installDir = grunt.config.get('atom.installDir') + shareDir = path.join(installDir, 'share', 'atom') + iconName = path.join(shareDir, 'resources', 'app', 'resources', 'atom.png') + + data = {name, version, description, section, maintainer, installDir, iconName} + specFilePath = fillTemplate(path.join('resources', 'linux', 'redhat', 'atom.spec'), data) + desktopFilePath = fillTemplate(path.join('resources', 'linux', 'Atom.desktop'), data) + + cmd = path.join('script', 'mkrpm') + args = [specFilePath, desktopFilePath] + spawn {cmd, args}, (error) -> + if error? + done(error) + else + grunt.log.ok "Created rpm package" + done() diff --git a/resources/linux/redhat/atom.spec.in b/resources/linux/redhat/atom.spec.in new file mode 100644 index 000000000..6b5ae889a --- /dev/null +++ b/resources/linux/redhat/atom.spec.in @@ -0,0 +1,29 @@ +Name: <%= name %> +Version: <%= version %> +Release: 0.1%{?dist} +Summary: Atom is a hackable text editor for the 21st century +License: MIT +URL: https://atom.io/ +BuildConflicts: gyp +BuildRequires: make, gcc, gcc-c++, glibc-devel, git-core, libgnome-keyring-devel +Requires: libgnome-keyring +AutoReqProv: no # Avoid libchromiumcontent.so missing dependency + +%description +<%= description %> + +%install +mkdir -p %{buildroot}/usr/local/share/atom +cp -r /tmp/atom-build/Atom/* %{buildroot}/usr/local/share/atom +mkdir -p %{buildroot}/usr/local/bin/ +ln -sf /usr/local/share/atom/resources/app/apm/node_modules/.bin/apm %{buildroot}/usr/local/bin/apm +cp atom.sh %{buildroot}/usr/local/bin/atom +chmod 755 atom.sh +mkdir -p %{buildroot}/usr/local/share/applications/ +mv Atom.desktop %{buildroot}/usr/local/share/applications/ + +%files +/usr/local/bin/atom +/usr/local/bin/apm +/usr/local/share/atom/ +/usr/local/share/applications/Atom.desktop diff --git a/script/mkrpm b/script/mkrpm new file mode 100755 index 000000000..cea3ebcab --- /dev/null +++ b/script/mkrpm @@ -0,0 +1,19 @@ +#!/bin/bash + +SPEC_FILE="$1" +DESKTOP_FILE="$2" + +RPM_BUILD_ROOT=~/rpmbuild +ARCH=`uname -m` + +rpmdev-setuptree + +cp -r /tmp/atom-build/Atom/* $RPM_BUILD_ROOT/BUILD +cp $SPEC_FILE $RPM_BUILD_ROOT/SPECS +cp ./atom.sh $RPM_BUILD_ROOT/BUILD +cp $DESKTOP_FILE $RPM_BUILD_ROOT/BUILD + +rpmbuild -ba $SPEC_FILE +cp $RPM_BUILD_ROOT/RPMS/$ARCH/atom-*.rpm "./" + +rm -rf $RPM_BUILD_ROOT From 503393122f4b5a09f4e26b80a75bd2ff5ba42a56 Mon Sep 17 00:00:00 2001 From: Ardeshir Javaherchi Date: Sat, 11 Oct 2014 17:07:05 -0700 Subject: [PATCH 2/3] :memo: Add Red Hat Linux to README file --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 25c61f643..5aa21b58a 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,17 @@ Currently only a 64-bit version is available. The Linux version does not currently automatically update so you will need to repeat these steps to upgrade to future releases. +### Red Hat Linux (Fedora, CentOS, Red Hat) + +Currently only a 64-bit version is available. + +1. Download `atom-amd64.rpm` from the [Atom releases page](https://github.com/atom/atom/releases/latest). +2. Run `sudo yum localinstall atom-amd64.rpm` on the downloaded package. +3. Launch Atom using the installed `atom` command. + +The Linux version does not currently automatically update so you will need to +repeat these steps to upgrade to future releases. + ## Building * [Linux](docs/build-instructions/linux.md) From 86fdbfbb15df432979964a4f0df86034c779924e Mon Sep 17 00:00:00 2001 From: Ardeshir Javaherchi Date: Wed, 15 Oct 2014 15:53:32 -0700 Subject: [PATCH 3/3] :penguin: Update to atom.desktop in mkrpm and remove extra variables --- build/tasks/mkrpm-task.coffee | 6 ++---- resources/linux/redhat/atom.spec.in | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/build/tasks/mkrpm-task.coffee b/build/tasks/mkrpm-task.coffee index 69fdffbd1..7ef11aae5 100644 --- a/build/tasks/mkrpm-task.coffee +++ b/build/tasks/mkrpm-task.coffee @@ -24,15 +24,13 @@ module.exports = (grunt) -> return done("Unsupported arch #{process.arch}") {name, version, description} = grunt.file.readJSON('package.json') - section = 'devel' - maintainer = 'GitHub ' installDir = grunt.config.get('atom.installDir') shareDir = path.join(installDir, 'share', 'atom') iconName = path.join(shareDir, 'resources', 'app', 'resources', 'atom.png') - data = {name, version, description, section, maintainer, installDir, iconName} + data = {name, version, description, installDir, iconName} specFilePath = fillTemplate(path.join('resources', 'linux', 'redhat', 'atom.spec'), data) - desktopFilePath = fillTemplate(path.join('resources', 'linux', 'Atom.desktop'), data) + desktopFilePath = fillTemplate(path.join('resources', 'linux', 'atom.desktop'), data) cmd = path.join('script', 'mkrpm') args = [specFilePath, desktopFilePath] diff --git a/resources/linux/redhat/atom.spec.in b/resources/linux/redhat/atom.spec.in index 6b5ae889a..61c4ed398 100644 --- a/resources/linux/redhat/atom.spec.in +++ b/resources/linux/redhat/atom.spec.in @@ -20,10 +20,10 @@ ln -sf /usr/local/share/atom/resources/app/apm/node_modules/.bin/apm %{buildroot cp atom.sh %{buildroot}/usr/local/bin/atom chmod 755 atom.sh mkdir -p %{buildroot}/usr/local/share/applications/ -mv Atom.desktop %{buildroot}/usr/local/share/applications/ +mv atom.desktop %{buildroot}/usr/local/share/applications/ %files /usr/local/bin/atom /usr/local/bin/apm /usr/local/share/atom/ -/usr/local/share/applications/Atom.desktop +/usr/local/share/applications/atom.desktop