2010-04-27 22:38:28 +02:00
|
|
|
# force.pp
|
|
|
|
# force a package from a specific release
|
|
|
|
|
|
|
|
define apt::force(
|
2011-05-30 19:24:06 +02:00
|
|
|
$release = 'testing',
|
|
|
|
$version = false
|
2010-04-27 22:38:28 +02:00
|
|
|
) {
|
2011-03-11 18:02:50 +01:00
|
|
|
|
2012-01-14 00:29:47 +01:00
|
|
|
$version_string = $version ? {
|
2012-03-21 14:20:13 +01:00
|
|
|
false => undef,
|
2012-01-14 00:29:47 +01:00
|
|
|
default => "=${version}",
|
|
|
|
}
|
|
|
|
|
2012-03-21 14:20:13 +01:00
|
|
|
$install_check = $version ? {
|
|
|
|
false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'",
|
|
|
|
default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'",
|
|
|
|
}
|
2012-01-14 00:29:47 +01:00
|
|
|
exec { "/usr/bin/aptitude -y -t ${release} install ${name}${version_string}":
|
2012-03-21 14:20:13 +01:00
|
|
|
unless => $install_check,
|
2011-05-30 19:24:06 +02:00
|
|
|
}
|
2010-04-27 22:38:28 +02:00
|
|
|
}
|