2010-10-17 13:58:59 +02:00
|
|
|
define apt::preferences_snippet(
|
2012-06-08 18:18:50 +02:00
|
|
|
$package = $name,
|
2010-10-17 14:13:02 +02:00
|
|
|
$ensure = 'present',
|
2010-10-25 06:14:33 +02:00
|
|
|
$source = '',
|
2010-10-17 14:13:02 +02:00
|
|
|
$release,
|
2010-12-07 19:18:41 +01:00
|
|
|
$priority )
|
|
|
|
{
|
|
|
|
|
2010-10-25 18:17:50 +02:00
|
|
|
if $custom_preferences == false {
|
|
|
|
fail("Trying to define a preferences_snippet with \$custom_preferences set to false.")
|
|
|
|
}
|
|
|
|
|
2010-10-17 14:29:01 +02:00
|
|
|
include apt::preferences
|
2010-10-25 06:14:33 +02:00
|
|
|
|
2011-08-05 10:57:13 +02:00
|
|
|
concat::fragment{"apt_preference_${name}":
|
2010-10-17 13:58:59 +02:00
|
|
|
ensure => $ensure,
|
2011-08-05 10:57:13 +02:00
|
|
|
target => '/etc/apt/preferences',
|
2010-10-17 13:58:59 +02:00
|
|
|
}
|
2010-10-25 06:14:33 +02:00
|
|
|
|
|
|
|
# This should really work in the same manner as sources_list and apt_conf
|
|
|
|
# snippets, but since the preferences.d directory cannot be used in Debian
|
|
|
|
# lenny, we can't generalize without going into ugly special-casing.
|
|
|
|
case $source {
|
2010-10-28 22:05:37 +02:00
|
|
|
'': {
|
2011-08-05 11:12:29 +02:00
|
|
|
Concat::Fragment["apt_preference_${name}"]{
|
2010-10-25 06:14:33 +02:00
|
|
|
content => template("apt/preferences_snippet.erb")
|
2010-10-28 22:05:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
default: {
|
2011-08-05 11:12:29 +02:00
|
|
|
Concat::Fragment["apt_preference_${name}"]{
|
2010-10-25 06:14:33 +02:00
|
|
|
source => $source
|
|
|
|
}
|
2010-10-28 22:05:37 +02:00
|
|
|
}
|
2010-10-25 06:14:33 +02:00
|
|
|
}
|
2010-10-17 13:58:59 +02:00
|
|
|
}
|