Skip to content

Commit

Permalink
Merge pull request #754 from jdolitsky/master
Browse files Browse the repository at this point in the history
add --rpm-init option
  • Loading branch information
jordansissel committed Oct 25, 2014
2 parents 0c9898c + 64fbb21 commit 7280243
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/fpm/package/rpm.rb
Expand Up @@ -98,6 +98,11 @@ class FPM::Package::RPM < FPM::Package
option "--attr", "ATTRFILE",
"Set the attribute for a file (%attr).",
:multivalued => true, :attribute_name => :attrs

option "--init", "FILEPATH", "Add FILEPATH as an init script",
:multivalued => true do |file|
next File.expand_path(file)
end

rpmbuild_filter_from_provides = []
option "--filter-from-provides", "REGEX",
Expand Down Expand Up @@ -151,7 +156,7 @@ class FPM::Package::RPM < FPM::Package
end

private

# Fix path name
# Replace [ with [\[] to make rpm not use globs
# Replace * with [*] to make rpm not use globs
Expand Down Expand Up @@ -455,6 +460,15 @@ def output(output_path)

self.config_files = allconfigs.map { |x| File.join("/", x) }

# add init script if present
(attributes[:rpm_init_list] or []).each do |init|
name = File.basename(init, ".init")
dest_init = File.join(staging_path, "etc/init.d/#{name}")
FileUtils.mkdir_p(File.dirname(dest_init))
FileUtils.cp init, dest_init
File.chmod(0755, dest_init)
end

(attributes[:rpm_rpmbuild_define] or []).each do |define|
args += ["--define", define]
end
Expand Down

0 comments on commit 7280243

Please sign in to comment.