2013-01-02 14:12:11 +01:00
|
|
|
define apt::upgrade_package (
|
|
|
|
$version = ''
|
|
|
|
) {
|
2010-12-07 19:18:41 +01:00
|
|
|
|
2013-01-02 14:12:11 +01:00
|
|
|
if $apt::disable_update == false {
|
|
|
|
include apt::update
|
2012-11-08 10:07:38 +01:00
|
|
|
}
|
2010-12-15 09:47:57 +01:00
|
|
|
|
|
|
|
$version_suffix = $version ? {
|
|
|
|
'' => '',
|
|
|
|
'latest' => '',
|
|
|
|
default => "=${version}",
|
|
|
|
}
|
|
|
|
|
2010-12-16 18:14:23 +01:00
|
|
|
if !defined(Package['apt-show-versions']) {
|
|
|
|
package { 'apt-show-versions':
|
2013-01-02 14:12:11 +01:00
|
|
|
ensure => installed,
|
2010-12-16 18:14:23 +01:00
|
|
|
require => undef,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !defined(Package['dctrl-tools']) {
|
|
|
|
package { 'dctrl-tools':
|
2013-01-02 14:12:11 +01:00
|
|
|
ensure => installed,
|
2010-12-16 18:14:23 +01:00
|
|
|
require => undef,
|
|
|
|
}
|
2010-12-15 15:18:16 +01:00
|
|
|
}
|
|
|
|
|
2013-01-02 14:12:11 +01:00
|
|
|
$req = $apt::disable_update ? {
|
|
|
|
true => Package['apt-show-versions', 'dctrl-tools'],
|
|
|
|
default => [
|
|
|
|
Exec['apt_updated'],
|
|
|
|
Package['apt-show-versions', 'dctrl-tools']
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2010-12-18 21:47:11 +01:00
|
|
|
exec { "apt-get -q -y -o 'DPkg::Options::=--force-confold' install ${name}${version_suffix}":
|
2013-01-02 14:12:11 +01:00
|
|
|
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
|
|
|
}
|
2010-12-15 09:47:57 +01:00
|
|
|
|
2009-10-30 20:20:42 +01:00
|
|
|
}
|