unless support for build and install, for non-standard thigns
This commit is contained in:
parent
ee91e03935
commit
246f2164c6
@ -10,7 +10,7 @@ Puppet::Type.type(:configure).provide(:action) do
|
||||
end
|
||||
|
||||
def exists?
|
||||
File.file? config_status
|
||||
unless? || File.file?(config_status)
|
||||
end
|
||||
|
||||
private
|
||||
@ -18,6 +18,13 @@ Puppet::Type.type(:configure).provide(:action) do
|
||||
File.join(@resource[:build_path], @resource[:config_status])
|
||||
end
|
||||
|
||||
def unless?
|
||||
return true if @resource[:unless].empty?
|
||||
|
||||
system %{bash -c '#{@resource[:unless]}'}
|
||||
$?.exitstatus == 0
|
||||
end
|
||||
|
||||
def path
|
||||
@resource[:path].empty? ? '' : "export PATH=#{@resource[:path]}:$PATH ; "
|
||||
end
|
||||
|
@ -15,10 +15,18 @@ Puppet::Type.type(:download_and_unpack).provide(:action) do
|
||||
end
|
||||
|
||||
def exists?
|
||||
File.directory?(File.join(@resource[:src_path], target_dir))
|
||||
unless? || (File.directory?(File.join(@resource[:src_path], target_dir)))
|
||||
end
|
||||
|
||||
private
|
||||
def unless?
|
||||
return true if @resource[:unless].empty?
|
||||
|
||||
system %{bash -c '#{@resource[:unless]}'}
|
||||
|
||||
$?.exitstatus == 0
|
||||
end
|
||||
|
||||
def file
|
||||
File.join(@resource[:src_path], File.basename(@resource[:url]))
|
||||
end
|
||||
|
@ -16,10 +16,17 @@ Puppet::Type.type(:make_and_install).provide(:action) do
|
||||
end
|
||||
|
||||
def exists?
|
||||
File.directory?(@resource[:install_path]) && File.symlink?(symlink_path)
|
||||
unless? || (File.directory?(@resource[:install_path]) && File.symlink?(symlink_path))
|
||||
end
|
||||
|
||||
private
|
||||
def unless?
|
||||
return true if @resource[:unless].empty?
|
||||
|
||||
system %{bash -c '#{@resource[:unless]}'}
|
||||
$?.exitstatus == 0
|
||||
end
|
||||
|
||||
def symlink_path
|
||||
File.join(File.dirname(@resource[:install_path]), @resource[:name])
|
||||
end
|
||||
|
@ -30,5 +30,9 @@ Puppet::Type.newtype(:configure) do
|
||||
newparam(:path) do
|
||||
desc "Path for executables"
|
||||
end
|
||||
|
||||
newparam(:unless) do
|
||||
desc "If provided, don't run the configure unless this condition is true"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -22,5 +22,9 @@ Puppet::Type.newtype(:download_and_unpack) do
|
||||
newparam(:original_name) do
|
||||
desc "The directory name that the software unpacks as"
|
||||
end
|
||||
|
||||
newparam(:unless) do
|
||||
desc "If provided, don't run the download unless this condition is true"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -22,5 +22,9 @@ Puppet::Type.newtype(:make_and_install) do
|
||||
newparam(:path) do
|
||||
desc "Binary path to add"
|
||||
end
|
||||
|
||||
newparam(:unless) do
|
||||
desc "If provided, don't run the make and install unless this condition is true"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
define build_and_install($version, $preconfigure = '', $original_name = '', $source, $path = '', $configure = '', $config_status = 'config.status') {
|
||||
define build_and_install($version, $preconfigure = '', $original_name = '', $source, $path = '', $configure = '', $config_status = 'config.status', $unless = '') {
|
||||
$full_source = inline_template($source)
|
||||
|
||||
$build_path = build_path($name, $version)
|
||||
@ -10,7 +10,8 @@ define build_and_install($version, $preconfigure = '', $original_name = '', $sou
|
||||
src_path => $base::src_path,
|
||||
original_name => $original_name,
|
||||
version => $version,
|
||||
ensure => present
|
||||
ensure => present,
|
||||
unless => $unless
|
||||
}
|
||||
|
||||
configure { $name:
|
||||
@ -21,7 +22,8 @@ define build_and_install($version, $preconfigure = '', $original_name = '', $sou
|
||||
path => $path,
|
||||
require => Download_and_unpack[$name],
|
||||
config_status => $config_status,
|
||||
ensure => present
|
||||
ensure => present,
|
||||
unless => $unless
|
||||
}
|
||||
|
||||
make_and_install { $name:
|
||||
@ -29,7 +31,8 @@ define build_and_install($version, $preconfigure = '', $original_name = '', $sou
|
||||
install_path => $install_path,
|
||||
path => $path,
|
||||
require => Configure[$name],
|
||||
ensure => present
|
||||
ensure => present,
|
||||
unless => $unless
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user