Rocket.Chat Client RPM from DEB Package
This is way out of date now
The information in this post is so out-dated that I wonder why I'm keeping it around. I guess I'm a digital hoarder...
I primarily use Fedora/Cent/RHEL distributions, so I was a bit sad when I found out the desktop client for Rocket.Chat did not have a pre-packaged RPM for me to download.
Not that I hold it against the team behind Rocket.Chat in the slightest. Package management is usually something I avoid like the plague.
So it came as slight shock that I found myself getting bored and generating an RPM for the Rocket.Chat desktop client.
Now, there is at least one project that can convert DEB to RPM (and RPM to DEB), but I didn't remember it's name (alien) until after I went down a few rabbit holes.
One such rabbit hole, and the one I ended up following to the end, was to use a combo of FPM and the existing DEB packages provided by the Rocket.Chat team.
Disclaimer: I've only tested this on Fedora 23 and I do not think this is the right way to generate an rpm...
Ok, now that I've got that out of the way, lets dive into how I did it.
First, I needed to get some packages installed via yum dnf. I needed ruby
and ruby-devel
to install FPM. To use FPM to build RPMs, I also needed
rpmdevtools
.
As root or via sudo:
dnf install ruby ruby-devel rpmdevtools
The rest will be done as a mortal user:
gem install fpm
Now, lets get the current release DEB package of the Rocket.Chat client. Version 1.0.0 at the time of writing.
wget https://github.com/RocketChat/Rocket.Chat.Electron/releases/download/v1.0.0/rocketchat-1.0.0-linux.deb
To extract this DEB package, I needed to use ar
and tar
. I also had to
create some landing zones along the way for the extracted data. Keeps things
nice and separated.
mkdir ~/deb_landingzone
mv rocketchat-1.0.0-linux.deb ~/deb_landingzone/
cd ~/deb_landingzone
ar vx rocketchat-1.0.0-linux.deb
mkdir rocketchat-client-extracted
tar xf data.tar.xz -C rocketchat-client-extracted/
Before I generate the RPM, I wanted to tweak the application shortcut file that
came with the DEB package. I didn't need to do this to get the package to
work, but I wanted to change the category and version within the file
rocketchat.desktop
(located in
rocketchat-client-extracted/usr/share/applications/
).
[Desktop Entry]
Version=1.0.0
Type=Application
Encoding=UTF-8
Name=Rocket.Chat
Comment=Rocket.Chat Native Cross-Platform Desktop Application via Electron.
Exec=/opt/rocketchat/rocketchat
Path=/opt/rocketchat/
Icon=/opt/rocketchat/icon.png
Terminal=false
Categories=Network;Chat;
Now that I had the Rocket.Chat client release extracted and tweaked to my liking, I could use FPM to make a new RPM from the extracted data.
fpm -s dir -t rpm -n rocketchat-client -v 1.0.0 -a native --license "MIT" --category "Network;Chat;" --url "https://rocket.chat/" --description "Have your own Slack like online chat, built with Meteor. https://rocket.chat/" -C rocketchat-client-extracted/
Quick rundown of them flags for FPM:
-
-s
set the source type -
It wasn't till after I chose 'dir' for the type that I found FPM has a 'deb' source type. Sticking with 'dir' for this post because I'm lazy and don't want to try it with the 'deb' type, though I suspect it would remove the need for extracting the DEB, but I digress. PLUS I would not have been able to tweak the Application Shortcut file if I didn't extract the DEB package. MAN this bullet point got long. Like...obnoxiously long. Sorry about that.
-
-t
set the target type -n
set the package name-v
set the package version-
-a
set the package architecture -
From the help for fpm: Usually matches 'uname -m'. For automatic values, you can use '-a all' or '-a native'. These two strings will be translated into the correct value for your platform and target package type.
-
--license
set the package's license -
Got this from here
-
--category
set the package's category. -
Not sure if I needed to do this...or if the category I chose is even right...
-
--url
set the package's URL --description
set the package's description-
-C
the directory containing the files/folders I want to package -
From the help for fpm: "Change directory to here before searching for files"
After that finished (and ignoring the epoch warnings), I had an RPM that I hoped would work. ONLY ONE WAY TO FIND OUT!!!
[quinnm@pnx-desktop-01 deb_landingzone]$ sudo dnf install ./rocketchat-client-1.0.0-1.x86_64.rpm
Last metadata expiration check performed 2:20:01 ago on Sun Feb 21 12:06:15 2016.
Dependencies resolved.
=========================================================================================================
Package Arch Version Repository Size
=========================================================================================================
Installing:
rocketchat-client x86_64 1.0.0-1 @commandline 38 M
Transaction Summary
=========================================================================================================
Install 1 Package
Total size: 38 M
Installed size: 100 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Installing : rocketchat-client-1.0.0-1.x86_64 1/1
Verifying : rocketchat-client-1.0.0-1.x86_64 1/1
Installed:
rocketchat-client.x86_64 1.0.0-1
Complete!
WOOT WOOT!! Looks like it worked!!
Obligatory "Pics or it didn't happen"