zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Packaging with FPM

December 3, 2018 by Igor Drobot Leave a Comment

If you ever tried to package a simple application with the native rpmbuild, you may know, what a pain it could be.
Writing of a spec file, understand the errors and the different build-stages. Automation and deployment can be simple and without additional overhead.

This way will work like s charm from the first try :-)

# Debian way
apt-get install ruby-dev
# or the SUSE way
zypper in ruby-devel
sudo gem install fpm

# Debian way apt-get install ruby-dev # or the SUSE way zypper in ruby-devel sudo gem install fpm

Basic Syntax:

fpm.ruby2.5 -s source_type -t target_type -n package_name -v version_number source_name_or_location

fpm.ruby2.5 -s source_type -t target_type -n package_name -v version_number source_name_or_location

RPM run:

fpm.ruby2.5 -s dir -t rpm -n sync-brain -v 0.0.1 -C sync-brain-0.1-1.x86_64

fpm.ruby2.5 -s dir -t rpm -n sync-brain -v 0.0.1 -C sync-brain-0.1-1.x86_64

Deb run:

fpm.ruby2.5 -s dir -t deb -n sync-brain -v 0.0.1 -C sync-brain-0.1-1.x86_64

fpm.ruby2.5 -s dir -t deb -n sync-brain -v 0.0.1 -C sync-brain-0.1-1.x86_64

Add description to the package:

--description "sync-brain logic"

--description "sync-brain logic"

Script that should be run at the appropriate time:

--after-install
--before-install
--after-remove
--before-remove

--after-install --before-install --after-remove --before-remove

Structure of the source directory:

vagrant-openSUSE-Leap:~ # tree sync-brain-0.1-1.x86_64/
sync-brain-0.1-1.x86_64/
└── opt
    └── sync-brain.sh

vagrant-openSUSE-Leap:~ # tree sync-brain-0.1-1.x86_64/ sync-brain-0.1-1.x86_64/ └── opt └── sync-brain.sh

You see, it’s a simple directory which can contain a simple script or a functional application.
Now its your turn, try it out and be successful with your projects.

Filed Under: Linux Tagged With: Automation, FPM, RPM

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok