Skip to content

Commit

Permalink
Add option to config to differentiate between exrm and distillery runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hermanverschooten committed Jan 5, 2017
1 parent 51ae5bb commit 86ee1d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/exrm_deb/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule ExrmDeb.Config do
defstruct name: nil, version: nil, licenses: nil, maintainers: nil,
external_dependencies: nil, maintainer_scripts: [],
config_files: [], homepage: nil, description: nil,
vendor: nil, arch: nil,
vendor: nil, arch: nil, distillery: false,
owner: [user: "root", group: "root"]

use Vex.Struct
Expand Down Expand Up @@ -38,7 +38,8 @@ defmodule ExrmDeb.Config do
{:name, Atom.to_string(release.name)},
{:version, release.version},
{:description, Project.config[:description]},
{:arch, Utils.Config.detect_arch}
{:arch, Utils.Config.detect_arch},
{:distillery, true}
] ++ config_from_package(Project.config[:package])

base_config =
Expand Down
13 changes: 11 additions & 2 deletions lib/exrm_deb/data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ defmodule ExrmDeb.Data do
debian package.
"""
alias ReleaseManager.Utils.Logger
alias ReleaseManager.Utils
alias ExrmDeb.Utils.Compression
alias ExrmDeb.Generators.{Changelog, Upstart, Systemd}
alias Mix.Project
Expand Down Expand Up @@ -35,7 +36,7 @@ defmodule ExrmDeb.Data do
end


# We don't use/need the .tar.gz file built be exrm, so
# We don't use/need the .tar.gz file built by exrm, so
# remove it from the data dir to reduce filesize.
defp remove_targz_file(data_dir, config) do
[data_dir, "opt", config.name, "#{config.name}-#{config.version}.tar.gz"]
Expand All @@ -54,11 +55,19 @@ defmodule ExrmDeb.Data do

defp copy_release(data_dir, config) do
dest = Path.join([data_dir, "opt", config.name])
src = Path.join([Project.build_path, "rel", config.name])
src = src_path(config)

debug("Copying #{src} into #{dest} directory")
{:ok, _} = File.cp_r(src, dest)

dest
end

defp src_path(%ExrmDeb.Config{distillery: true} = config) do
Path.join([Project.build_path, "rel", config.name])
end

defp src_path(config) do
Path.join([Utils.rel_dest_path, config.name])
end
end

0 comments on commit 86ee1d2

Please sign in to comment.