2010-10-17 13:58:59 +02:00
|
|
|
define apt::preferences_snippet(
|
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,
|
|
|
|
$priority
|
2010-10-17 13:58:59 +02:00
|
|
|
){
|
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
|
|
|
|
2010-10-17 14:27:27 +02:00
|
|
|
file { "${apt::preferences::apt_preferences_dir}/${name}":
|
2010-10-17 13:58:59 +02:00
|
|
|
ensure => $ensure,
|
2010-10-25 06:14:33 +02:00
|
|
|
#TODO this template is somewhat limited
|
2010-10-17 14:27:27 +02:00
|
|
|
notify => Exec["concat_${apt::preferences::apt_preferences_dir}"],
|
2010-10-17 13:58:59 +02:00
|
|
|
owner => root, group => 0, mode => 0600;
|
|
|
|
}
|
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
|
|
|
'': {
|
|
|
|
File["${apt::preferences::apt_preferences_dir}/${name}"] {
|
2010-10-25 06:14:33 +02:00
|
|
|
content => template("apt/preferences_snippet.erb")
|
2010-10-28 22:05:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
File["${apt::preferences::apt_preferences_dir}/${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
|
|
|
}
|