From 636cacd72c8b82f3e812e7b53499afff89ccded9 Mon Sep 17 00:00:00 2001 From: Christophe Bliard Date: Fri, 29 Aug 2014 16:23:21 +0200 Subject: [PATCH] add support for LinuxMint operating system --- manifests/backports.pp | 23 ++++++++++++++++--- manifests/params.pp | 36 +++++++++++++++++++++++------- spec/classes/backports_spec.rb | 40 ++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 11 deletions(-) diff --git a/manifests/backports.pp b/manifests/backports.pp index eafa506..c45bc15 100644 --- a/manifests/backports.pp +++ b/manifests/backports.pp @@ -38,12 +38,29 @@ class apt::backports( fail('$pin_priority must be an integer') } - $release_real = downcase($release) - $key = $::lsbdistid ? { + if $::lsbdistid == 'LinuxMint' { + $distid = $::lsbdistcodename ? { + 'debian' => 'debian', + default => 'ubuntu', + } + $release_real = $::lsbdistcodename ? { + 'debian' => 'wheezy', + 'qiana' => 'trusty', + 'petra' => 'saucy', + 'olivia' => 'raring', + 'nadia' => 'quantal', + 'maya' => 'precise', + } + } else { + $distid = $::lsbdistid + $release_real = downcase($release) + } + + $key = $distid ? { 'debian' => '46925553', 'ubuntu' => '437D05B5', } - $repos = $::lsbdistid ? { + $repos = $distid ? { 'debian' => 'main contrib non-free', 'ubuntu' => 'main universe multiverse restricted', } diff --git a/manifests/params.pp b/manifests/params.pp index d57b801..20ad8d8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,8 +6,34 @@ class apt::params { $preferences_d = "${root}/preferences.d" case $::lsbdistid { + 'linuxmint': { + $distid = $::lsbdistcodename ? { + 'debian' => 'debian', + default => 'ubuntu', + } + $distcodename = $::lsbdistcodename ? { + 'debian' => 'wheezy', + 'qiana' => 'trusty', + 'petra' => 'saucy', + 'olivia' => 'raring', + 'nadia' => 'quantal', + 'maya' => 'precise', + } + } + 'ubuntu', 'debian': { + $distid = $::lsbdistid + $distcodename = $::lsbdistcodename + } + '': { + fail('Unable to determine lsbdistid, is lsb-release installed?') + } + default: { + fail("Unsupported lsbdistid (${::lsbdistid})") + } + } + case $distid { 'debian': { - case $::lsbdistcodename { + case $distcodename { 'squeeze': { $backports_location = 'http://backports.debian.org/debian-backports' $legacy_origin = true @@ -28,7 +54,7 @@ class apt::params { } } 'ubuntu': { - case $::lsbdistcodename { + case $distcodename { 'lucid': { $backports_location = 'http://us.archive.ubuntu.com/ubuntu' $ppa_options = undef @@ -49,11 +75,5 @@ class apt::params { } } } - '': { - fail('Unable to determine lsbdistid, is lsb-release installed?') - } - default: { - fail("Unsupported lsbdistid (${::lsbdistid})") - } } } diff --git a/spec/classes/backports_spec.rb b/spec/classes/backports_spec.rb index 2f67aa4..17c86eb 100644 --- a/spec/classes/backports_spec.rb +++ b/spec/classes/backports_spec.rb @@ -71,6 +71,46 @@ describe 'apt::backports', :type => :class do } end + describe "when turning on backports for linux mint debian edition" do + + let :facts do + { + 'lsbdistcodename' => 'debian', + 'lsbdistid' => 'LinuxMint', + } + end + + it { should contain_apt__source('backports').with({ + 'location' => 'http://ftp.debian.org/debian/', + 'release' => 'wheezy-backports', + 'repos' => 'main contrib non-free', + 'key' => '46925553', + 'key_server' => 'pgp.mit.edu', + 'pin' => 200, + }) + } + end + + describe "when turning on backports for linux mint 17 (ubuntu-based)" do + + let :facts do + { + 'lsbdistcodename' => 'qiana', + 'lsbdistid' => 'LinuxMint', + } + end + + it { should contain_apt__source('backports').with({ + 'location' => 'http://us.archive.ubuntu.com/ubuntu', + 'release' => 'trusty-backports', + 'repos' => 'main universe multiverse restricted', + 'key' => '437D05B5', + 'key_server' => 'pgp.mit.edu', + 'pin' => 200, + }) + } + end + describe "when turning on backports for debian squeeze but using your own mirror" do let :facts do -- 2.32.3