From e2f80db7b76171e5945127e2fd42fb35043990fb Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 17 Oct 2010 01:35:37 +0200 Subject: Bring in a bit of Ubuntu support from Nadir. --- README | 2 + manifests/default_preferences.pp | 32 +++++++----- manifests/default_sources_list.pp | 2 +- templates/Debian/preferences_lenny.erb | 24 +++++++++ templates/Debian/preferences_sid.erb | 9 ++++ templates/Debian/preferences_squeeze.erb | 24 +++++++++ templates/Debian/sources.list.erb | 83 ++++++++++++++++++++++++++++++++ templates/Ubuntu/sources.list.erb | 22 +++++++++ templates/preferences_lenny.erb | 24 --------- templates/preferences_sid.erb | 9 ---- templates/preferences_squeeze.erb | 24 --------- templates/sources.list.erb | 83 -------------------------------- 12 files changed, 184 insertions(+), 154 deletions(-) create mode 100644 templates/Debian/preferences_lenny.erb create mode 100644 templates/Debian/preferences_sid.erb create mode 100644 templates/Debian/preferences_squeeze.erb create mode 100644 templates/Debian/sources.list.erb create mode 100644 templates/Ubuntu/sources.list.erb delete mode 100644 templates/preferences_lenny.erb delete mode 100644 templates/preferences_sid.erb delete mode 100644 templates/preferences_squeeze.erb delete mode 100644 templates/sources.list.erb diff --git a/README b/README index d1249a0..8dafe2f 100644 --- a/README +++ b/README @@ -15,6 +15,8 @@ sources.list and apt_preferences are managed. More recent Debian releases are pinned to very low values by default to prevent accidental upgrades. +Ubuntu support is lagging behind but not absent either. + This module needs lsb-release installed. diff --git a/manifests/default_preferences.pp b/manifests/default_preferences.pp index 521d2f2..605ba78 100644 --- a/manifests/default_preferences.pp +++ b/manifests/default_preferences.pp @@ -1,16 +1,22 @@ class apt::default_preferences { - config_file { - # this just pins unstable and testing to very low values - "/etc/apt/preferences": - content => template("apt/preferences_${codename}.erb"), - # use File[apt_config] to reference a completed configuration - # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML - alias => apt_config, - # only update together - require => File["/etc/apt/sources.list"]; - # little default settings which keep the system sane - "/etc/apt/apt.conf.d/from_puppet": - content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n", - before => Config_file[apt_config]; + case $operatingsystem { + 'debian': { + config_file { + "/etc/apt/preferences": + content => template("apt/${operatingsystem}/preferences_${codename}.erb"), + # use File[apt_config] to reference a completed configuration + # See "The Puppet Semaphor" 2007-06-25 on the puppet-users ML + alias => apt_config, + # only update together + require => File["/etc/apt/sources.list"]; + # little default settings which keep the system sane + "/etc/apt/apt.conf.d/from_puppet": + content => "APT::Get::Show-Upgraded true;\nDSelect::Clean $real_apt_clean;\n", + before => Config_file[apt_config]; + } + } + 'ubuntu': { + notice('There is no support for default Ubuntu APT preferences') + } } } diff --git a/manifests/default_sources_list.pp b/manifests/default_sources_list.pp index 34234e3..0e78c02 100644 --- a/manifests/default_sources_list.pp +++ b/manifests/default_sources_list.pp @@ -3,7 +3,7 @@ class apt::default_sources_list { # include main, security and backports # additional sources could be included via an array "/etc/apt/sources.list": - content => template("apt/sources.list.erb"), + content => template("apt/${operatingsystem}/sources.list.erb"), } } diff --git a/templates/Debian/preferences_lenny.erb b/templates/Debian/preferences_lenny.erb new file mode 100644 index 0000000..3de7959 --- /dev/null +++ b/templates/Debian/preferences_lenny.erb @@ -0,0 +1,24 @@ +Explanation: Debian <%= codename %> +Package: * +Pin: release o=Debian,n=<%= codename %> +Pin-Priority: 990 + +Explanation: Debian backports +Package: * +Pin: origin backports.debian.org +Pin-Priority: 200 + +Explanation: Debian <%= next_codename %> +Package: * +Pin: release o=Debian,n=<%= next_codename %> +Pin-Priority: 2 + +Explanation: Debian sid +Package: * +Pin: release o=Debian,n=sid +Pin-Priority: 1 + +Explanation: Debian fallback +Package: * +Pin: release o=Debian +Pin-Priority: -10 diff --git a/templates/Debian/preferences_sid.erb b/templates/Debian/preferences_sid.erb new file mode 100644 index 0000000..3d8a45f --- /dev/null +++ b/templates/Debian/preferences_sid.erb @@ -0,0 +1,9 @@ +Explanation: Debian sid +Package: * +Pin: release o=Debian,n=sid +Pin-Priority: 990 + +Explanation: Debian fallback +Package: * +Pin: release o=Debian +Pin-Priority: -10 diff --git a/templates/Debian/preferences_squeeze.erb b/templates/Debian/preferences_squeeze.erb new file mode 100644 index 0000000..f21562d --- /dev/null +++ b/templates/Debian/preferences_squeeze.erb @@ -0,0 +1,24 @@ +Explanation: Debian <%= codename %> +Package: * +Pin: release o=Debian,n=<%= codename %> +Pin-Priority: 990 + +Explanation: Debian backports +Package: * +Pin: origin backports.debian.org +Pin-Priority: 200 + +Explanation: Debian wheezy +Package: * +Pin: release o=Debian,n=wheezy +Pin-Priority: 2 + +Explanation: Debian sid +Package: * +Pin: release o=Debian,n=sid +Pin-Priority: 1 + +Explanation: Debian fallback +Package: * +Pin: release o=Debian +Pin-Priority: -10 diff --git a/templates/Debian/sources.list.erb b/templates/Debian/sources.list.erb new file mode 100644 index 0000000..67da85d --- /dev/null +++ b/templates/Debian/sources.list.erb @@ -0,0 +1,83 @@ +# This file is brought to you by puppet + +### Debian current: <%= codename %> + +# basic +deb <%= debian_url %> <%= codename %> <%= repos %> +<% if include_src then -%> +deb-src <%= debian_url %> <%= codename %> <%= repos %> +<% end -%> + +# security +<% if (release == "unstable" || release == "experimental") -%> +# There is no security support for <%= release %> +<% else -%> +deb <%= security_url %> <%= codename %>/updates <%= repos %> +<% if include_src then -%> +deb-src <%= security_url %> <%= codename %>/updates <%= repos %> +<% end -%> +<% end -%> + +# backports +<% if (release == "testing" || release == "unstable" || release == "experimental") -%> +# There is no backports archive for <%= release %> +<% else -%> +deb <%= backports_url %> <%= codename %>-backports <%= repos %> +<% if include_src then -%> +deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> +<% end -%> +<% end -%> + +<% if use_volatile -%> +# volatile +<% if (release == "testing" || release == "unstable" || release == "experimental") -%> +# There is no volatile archive for <%= release %> +<% else -%> +deb <%= volatile_url %> <%= codename %>/volatile <%= repos %> +<% if include_src then -%> +deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %> +<% end -%> +<% end -%> +<% end -%> + +<% if use_next_release then -%> +### Debian next: <%= next_codename %> + +# basic +deb <%= debian_url %> <%= next_codename %> <%= repos %> +<% if include_src then -%> +deb-src <%= debian_url %> <%= next_codename %> <%= repos %> +<% end -%> + +# security +<% if (next_release == "unstable" || next_release == "experimental") -%> +# There is no security support for <%= next_release %> +<% else -%> +deb <%= security_url %> <%= next_codename %>/updates <%= repos %> +<% if include_src then -%> +deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> +<% end -%> +<% end -%> + +# backports +<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> +# There is no backports archive for <%= next_release %> +<% else -%> +deb <%= backports_url %> <%= next_codename %>-backports <%= repos %> +<% if include_src then -%> +deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %> +<% end -%> +<% end -%> + +<% if use_volatile -%> +# volatile +<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> +# There is no volatile archive for <%= next_release %> +<% else -%> +deb <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> +<% if include_src then -%> +deb-src <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> +<% end -%> +<% end -%> +<% end -%> +<% end -%> diff --git a/templates/Ubuntu/sources.list.erb b/templates/Ubuntu/sources.list.erb new file mode 100644 index 0000000..44f3024 --- /dev/null +++ b/templates/Ubuntu/sources.list.erb @@ -0,0 +1,22 @@ +# This file is brought to you by puppet + +# basic <%= lsbdistcodename %> +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse +<% if include_src then -%> +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %> main restricted universe multiverse +<% end -%> + +# updates +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse +<% if include_src then -%> +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-updates main restricted universe multiverse +<% end -%> + +# security suppport +deb http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse +<% if include_src then -%> +deb-src http://de.archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main restricted universe multiverse +<% end -%> + +# backports +deb http://archive.ubuntu.com/ubuntu <%= lsbdistcodename %>-backports main universe multiverse restricted diff --git a/templates/preferences_lenny.erb b/templates/preferences_lenny.erb deleted file mode 100644 index 3de7959..0000000 --- a/templates/preferences_lenny.erb +++ /dev/null @@ -1,24 +0,0 @@ -Explanation: Debian <%= codename %> -Package: * -Pin: release o=Debian,n=<%= codename %> -Pin-Priority: 990 - -Explanation: Debian backports -Package: * -Pin: origin backports.debian.org -Pin-Priority: 200 - -Explanation: Debian <%= next_codename %> -Package: * -Pin: release o=Debian,n=<%= next_codename %> -Pin-Priority: 2 - -Explanation: Debian sid -Package: * -Pin: release o=Debian,n=sid -Pin-Priority: 1 - -Explanation: Debian fallback -Package: * -Pin: release o=Debian -Pin-Priority: -10 diff --git a/templates/preferences_sid.erb b/templates/preferences_sid.erb deleted file mode 100644 index 3d8a45f..0000000 --- a/templates/preferences_sid.erb +++ /dev/null @@ -1,9 +0,0 @@ -Explanation: Debian sid -Package: * -Pin: release o=Debian,n=sid -Pin-Priority: 990 - -Explanation: Debian fallback -Package: * -Pin: release o=Debian -Pin-Priority: -10 diff --git a/templates/preferences_squeeze.erb b/templates/preferences_squeeze.erb deleted file mode 100644 index f21562d..0000000 --- a/templates/preferences_squeeze.erb +++ /dev/null @@ -1,24 +0,0 @@ -Explanation: Debian <%= codename %> -Package: * -Pin: release o=Debian,n=<%= codename %> -Pin-Priority: 990 - -Explanation: Debian backports -Package: * -Pin: origin backports.debian.org -Pin-Priority: 200 - -Explanation: Debian wheezy -Package: * -Pin: release o=Debian,n=wheezy -Pin-Priority: 2 - -Explanation: Debian sid -Package: * -Pin: release o=Debian,n=sid -Pin-Priority: 1 - -Explanation: Debian fallback -Package: * -Pin: release o=Debian -Pin-Priority: -10 diff --git a/templates/sources.list.erb b/templates/sources.list.erb deleted file mode 100644 index 67da85d..0000000 --- a/templates/sources.list.erb +++ /dev/null @@ -1,83 +0,0 @@ -# This file is brought to you by puppet - -### Debian current: <%= codename %> - -# basic -deb <%= debian_url %> <%= codename %> <%= repos %> -<% if include_src then -%> -deb-src <%= debian_url %> <%= codename %> <%= repos %> -<% end -%> - -# security -<% if (release == "unstable" || release == "experimental") -%> -# There is no security support for <%= release %> -<% else -%> -deb <%= security_url %> <%= codename %>/updates <%= repos %> -<% if include_src then -%> -deb-src <%= security_url %> <%= codename %>/updates <%= repos %> -<% end -%> -<% end -%> - -# backports -<% if (release == "testing" || release == "unstable" || release == "experimental") -%> -# There is no backports archive for <%= release %> -<% else -%> -deb <%= backports_url %> <%= codename %>-backports <%= repos %> -<% if include_src then -%> -deb-src <%= backports_url %> <%= codename %>-backports <%= repos %> -<% end -%> -<% end -%> - -<% if use_volatile -%> -# volatile -<% if (release == "testing" || release == "unstable" || release == "experimental") -%> -# There is no volatile archive for <%= release %> -<% else -%> -deb <%= volatile_url %> <%= codename %>/volatile <%= repos %> -<% if include_src then -%> -deb-src <%= volatile_url %> <%= codename %>/volatile <%= repos %> -<% end -%> -<% end -%> -<% end -%> - -<% if use_next_release then -%> -### Debian next: <%= next_codename %> - -# basic -deb <%= debian_url %> <%= next_codename %> <%= repos %> -<% if include_src then -%> -deb-src <%= debian_url %> <%= next_codename %> <%= repos %> -<% end -%> - -# security -<% if (next_release == "unstable" || next_release == "experimental") -%> -# There is no security support for <%= next_release %> -<% else -%> -deb <%= security_url %> <%= next_codename %>/updates <%= repos %> -<% if include_src then -%> -deb-src <%= security_url %> <%= next_codename %>/updates <%= repos %> -<% end -%> -<% end -%> - -# backports -<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> -# There is no backports archive for <%= next_release %> -<% else -%> -deb <%= backports_url %> <%= next_codename %>-backports <%= repos %> -<% if include_src then -%> -deb-src <%= backports_url %> <%= next_codename %>-backports <%= repos %> -<% end -%> -<% end -%> - -<% if use_volatile -%> -# volatile -<% if (next_release == "testing" || next_release == "unstable" || next_release == "experimental") -%> -# There is no volatile archive for <%= next_release %> -<% else -%> -deb <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> -<% if include_src then -%> -deb-src <%= volatile_url %> <%= next_codename %>/volatile <%= repos %> -<% end -%> -<% end -%> -<% end -%> -<% end -%> -- cgit v1.2.3