Permalink
Browse files

Merge pull request #260 from ajf8/rpm-directories

issue 245 (RPM's with non-root owners doesn't set ownership of directori...
  • Loading branch information...
2 parents 8efef09 + a88cca4 commit 4b6d3b3a489be4e0ee06e5f35c9950a9059b5a98 @jordansissel committed Nov 8, 2012
Showing with 16 additions and 1 deletion.
  1. +8 −0 lib/fpm/command.rb
  2. +4 −1 lib/fpm/package.rb
  3. +1 −0 lib/fpm/package/rpm.rb
  4. +3 −0 templates/rpm.erb
View
@@ -89,6 +89,12 @@ class FPM::Command < Clamp::Command
@config_files ||= []
@config_files << val
end # --config-files
+ option "--directories", "DIRECTORIES",
+ "Mark a directory as being owned by the package" \
+ do |val|
+ @directories ||= []
+ @directories << val
+ end # directories
option ["-a", "--architecture"], "ARCHITECTURE",
"The architecture name. Usually matches 'uname -m'. For automatic values," \
" you can use '-a all' or '-a native'. These two strings will be " \
@@ -204,6 +210,7 @@ def initialize(*args)
@provides = []
@dependencies = []
@config_files = []
+ @directories = []
@excludes = []
end # def initialize
@@ -332,6 +339,7 @@ def execute
input.provides += provides
input.replaces += replaces
input.config_files += config_files
+ input.directories += directories
setscript = proc do |scriptname|
# 'self.send(scriptname) == self.before_install == --before-install
View
@@ -104,6 +104,8 @@ def to_s
# Array of configuration files
attr_accessor :config_files
+ attr_accessor :directories
+
# Any other attributes specific to this package.
# This is where you'd put rpm, deb, or other specific attributes.
attr_accessor :attributes
@@ -168,6 +170,7 @@ def initialize
@dependencies = []
@scripts = {}
@config_files = []
+ @directories = []
staging_path
build_path
@@ -194,7 +197,7 @@ def convert(klass)
:@architecture, :@attributes, :@category, :@config_files, :@conflicts,
:@dependencies, :@description, :@epoch, :@iteration, :@license, :@maintainer,
:@name, :@provides, :@replaces, :@scripts, :@url, :@vendor, :@version,
- :@config_files, :@staging_path
+ :@directories, :@staging_path
]
ivars.each do |ivar|
#@logger.debug("Copying ivar", :ivar => ivar, :value => instance_variable_get(ivar),
View
@@ -167,6 +167,7 @@ def input(path)
#input.replaces += replaces
self.config_files += rpm.config_files
+ self.directories += rpm.directories
# Extract to the staging directory
rpm.extract(staging_path)
View
@@ -107,6 +107,9 @@ fi
<% config_files.each do |path| -%>
%config(noreplace) <%= File.join(prefix, path) %>
<% end -%>
+<% directories.each do |path| -%>
+%dir <%= File.join(prefix, path) %>
+<% end -%>
<%# list only files, not directories? -%>
<%=
# Reject config files already listed or parent directories, then prefix files

0 comments on commit 4b6d3b3

Please sign in to comment.