Skip to content

Commit

Permalink
added support for additional installation files
Browse files Browse the repository at this point in the history
  • Loading branch information
smpallen99 committed Jul 2, 2014
1 parent dc6f699 commit 7fa1189
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ 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.
### Add additional installation files

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.

## Additional Notes

- The generated rpm installs the following
Expand Down
13 changes: 13 additions & 0 deletions lib/exrm_rpm/exrm_rpm.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule ReleaseManager.Plugin.Rpm do
@_DEFAULT_SUMMARY "Add a summary entry in your project config"
@_DEFAULT_DESCRIPTION "Add a description your config file"
@_RPM_TEMPLATE_DIR Path.join([@_RPM_DIR, "templates"])
@_EXTRA_SOURCES Path.join([@_RPM_DIR, "sources"])

@_RPM_SPEC_DIRS [
["SPECS"],
Expand All @@ -34,6 +35,7 @@ defmodule ReleaseManager.Plugin.Rpm do
|> do_config
|> do_spec
|> do_init_script
|> copy_extra_sources
|> create_rpm
end

Expand Down Expand Up @@ -69,6 +71,7 @@ defmodule ReleaseManager.Plugin.Rpm do
app_tar_path: Path.join([File.cwd!, "rel", name, app_name]),
summary: @_DEFAULT_SUMMARY,
description: @_DEFAULT_DESCRIPTION,
extra_sources: @_EXTRA_SOURCES,
], do: {item, get_config_item(config, item, default)} )
|> Enum.into(%{}))
end
Expand Down Expand Up @@ -106,6 +109,16 @@ defmodule ReleaseManager.Plugin.Rpm do
config
end

defp copy_extra_sources(config) do
debug "Copying additional sources..."

if File.exists? config.extra_sources do
dest = Path.join([config.build_dir, "SOURCES"])
File.cp_r! config.extra_sources, dest
end
config
end

defp create_rpm(config) do
debug "Building rpm..."

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule ExrmRpm.Mixfile do

def project do
[app: :exrm_rpm,
version: "0.2.0",
version: "0.3.0",
elixir: "~> 0.13.2",
description: description,
package: package,
Expand Down

0 comments on commit 7fa1189

Please sign in to comment.