module-apt/manifests/upgrade_package.pp

43 lines
976 B
ObjectPascal
Raw Normal View History

define apt::upgrade_package (
$version = ''
) {
2010-12-07 19:18:41 +01:00
if $apt::disable_update == false {
include apt::update
}
$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
}
$req = $apt::disable_update ? {
true => Package['apt-show-versions', 'dctrl-tools'],
default => [
Exec['apt_updated'],
Package['apt-show-versions', 'dctrl-tools']
],
}
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 => $req
2009-10-30 20:20:42 +01:00
}
2009-10-30 20:20:42 +01:00
}