module-apt/manifests/upgrade_package.pp

34 lines
885 B
ObjectPascal
Raw Normal View History

# Install a package either to a certain version, or while making sure that it's
# always the latest version that's installed.
define apt::upgrade_package (
$version = ''
) {
2010-12-07 19:18:41 +01:00
$version_suffix = $version ? {
'' => '',
'latest' => '',
default => "=${version}",
}
if !defined(Package['apt-show-versions']) {
package { 'apt-show-versions':
ensure => installed,
require => undef,
}
}
if !defined(Package['dctrl-tools']) {
package { 'dctrl-tools':
ensure => installed,
require => undef,
}
2010-12-15 15:18:16 +01:00
}
exec { "apt-get -q -y -o 'DPkg::Options::=--force-confold' install ${name}${version_suffix}":
onlyif => [ "grep-status -F Status installed -a -P ${name} -q", "apt-show-versions -u ${name} | grep -q upgradeable" ],
require => Package['apt-show-versions', 'dctrl-tools'],
before => Exec['apt_updated']
2009-10-30 20:20:42 +01:00
}
2009-10-30 20:20:42 +01:00
}