Adds simple Red Hat Package Manager (RPM) generation as a Mix task.
You can build an rpm at the same time as building a release by adding the --rpm
option to release
mix release --rpm
This task first constructs the release using exrm
, then generates an rpm file for the release. The rpm is build using
default spec file and init script templates. If you would like to customize the templates, you can first run the release.copy_rpm_templates
task.
mix release.rpm.copy.templates
To see what flags can be passed, use mix help release.rpm.copy.templates
.
The _build/rpm
directory tree, along with the rest of the release with mix release.clean
Please visit exrm for additional information.
This project's goal is to make building a rpm for an Elixir release very simple, by adding the rpm features to Mix. To get started:
defp deps do
[{:exrm_rpm, "~> 0.4.0"}]
end
mix deps.get
mix deps.compile
mix rpm.build
> scp rel/test/releases/0.0.1/test-0.0.1-0.x86_64.rpm [email protected]:/tmp/
> ssh [email protected]
> rpm -i /tmp/test-0.0.1-0.x86_64.rpm
> service test start
> service test stop
> service test status
> service test restart
> service test remote_console
> service test console
Edit your projects config/config.exs
file
[
test: [
summary: "An example rpm build project ...",
description: """
This is the description of my test project.
Use it wisely...
""",
]
]
Copy the templates with:
mix rpm.copy.templates
Now edit the spec template in your favorite text editor
vim rpm/templates/spec
You can also edit the init script template
vim rpm/templates/init_script
The next time you run mix release --rpm
, it will use the custom templates.
Lack of support for a mix task to remove custom templates is deliberate. Once created, these files are considered part of your projects source code and should be managed appropriately.
If your application requires additional installation files, create a new sources
directory under the rpm
directory.
mkdir rpm/sources
Add the additional files into this directory. They will be copied into the build 'SOURCES' directory prior to running rpm-build.
Finally, add the new sources in the spec template and the appropriate spec file logic to process the additional files.
-
The generated rpm installs the following
- the release in
/usr/local/app_name
- an init.d script to manage the service
- the release in
-
During the rpm build process, the following directory tree and files are created:
_build/rpm/SPECS/name.spec
- the generated spec file used to build the rpm_build/rpm/SOURCES/name
- the generated init script included in the rpmrel/name/releases/version/name-version-arch.rpm
- the generated rpm
- Thanks to @bitwalker for the exrm plugin capabilities and all his help.
This project was built based on my experience building RPMs for E-MetroTels's products. I welcome input from others.
exrm_rpm is copyright (c) 2014-2016 E-MetroTel.
The source code is released under the MIT License.
Check LICENSE for more information.