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