mirror of
https://github.com/jordansissel/fpm
synced 2025-09-18 11:11:25 +02:00
- refactor to allow package targets to override generate_specfile so
puppet target can write multiple files (::package class and anticlass).
This commit is contained in:
parent
91918e0a3d
commit
710fe90df0
34
templates/puppet/package.pp.erb
Normal file
34
templates/puppet/package.pp.erb
Normal file
@ -0,0 +1,34 @@
|
||||
# TODO(sissel): implement 'anti' class for this package.
|
||||
class <%= name %>::package {
|
||||
$version = "<%= version %>"
|
||||
$iteration = "<%= iteration %>"
|
||||
|
||||
file {
|
||||
<% paths.each do |path|
|
||||
stat = File.lstat(path)
|
||||
params = {}
|
||||
if stat.directory?
|
||||
params[:ensure] = "directory"
|
||||
elsif stat.symlink?
|
||||
params[:ensure] = "link"
|
||||
params[:target] = File.readlink(path)
|
||||
stat = File.stat(path)
|
||||
else
|
||||
params[:ensure] = "file"
|
||||
params[:source] = "puppet:///modules/#{name}/#{path}"
|
||||
end
|
||||
|
||||
if params[:ensure] != "link"
|
||||
params[:owner] = uid2user(stat.uid)
|
||||
params[:group] = gid2group(stat.gid)
|
||||
params[:mode] = sprintf("%04o", stat.mode & 0777)
|
||||
end
|
||||
|
||||
settings = puppetsort(params).collect { |k,v| "#{k} => \"#{v}\"" }.join(",\n ")
|
||||
-%>
|
||||
# <%= stat.inspect %>
|
||||
"<%= fixpath(path) %>":
|
||||
<%= settings %>;
|
||||
<% end # paths.each -%>
|
||||
}
|
||||
}
|
11
templates/puppet/package/remove.pp.erb
Normal file
11
templates/puppet/package/remove.pp.erb
Normal file
@ -0,0 +1,11 @@
|
||||
class <%= name %>::package::remove {
|
||||
$version = "<%= version %>"
|
||||
$iteration = "<%= iteration %>"
|
||||
|
||||
file {
|
||||
<% paths.each do |path| -%>
|
||||
"<%= fixpath(path) %>":
|
||||
<%= settings %>;
|
||||
<% end # paths.each -%>
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user