summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2008-09-29 13:39:18 -0400
committerMicah Anderson <micah@riseup.net>2008-09-29 13:39:18 -0400
commit377e095431afc89b6e3bb4cc9abd2d1508a042b0 (patch)
treefec1bc667f7f595115b52b6269274ffb55e8d01b /manifests
parentee506f7586ee983287f95109c14e73447457283e (diff)
add the preseeded_package define which simplifies apt preseeding
automatically making sure that the preseeding directories are present and pulling the seed file from templates/$debian_version/$name.seeds which enables you to define things such as: apt::preseeded_package { [ locales, popularity-contest, apt-listchanges, apticron]: } and the .seed files will be automatically pulled and populated
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp49
1 files changed, 48 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 3128a92..77d5a7f 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -133,8 +133,55 @@ class apt {
}
}
}
-}
+
+ # workaround for preseeded_package component
+ file { "/var/cache": ensure => directory }
+ file { "/var/cache/local": ensure => directory }
+ file { "/var/cache/local/preseeding/": ensure => directory }
+
+ define preseeded_package ($content = "", $ensure = "installed") {
+ $seedfile = "/var/cache/local/preseeding/$name.seeds"
+ $real_content = $content ? {
+ "" => template ( "$debian_version/$name.seeds" ),
+ Default => $content
+ }
+
+ file{ $seedfile:
+ content => $real_content,
+ mode => 0600, owner => root, group => root,
+ }
+
+ package { $name:
+ ensure => $ensure,
+ responsefile => $seedfile,
+ require => File[$seedfile],
+ }
+ }
+
+ # workaround for preseeded_package component
+ file { "/var/cache": ensure => directory }
+ file { "/var/cache/local": ensure => directory }
+ file { "/var/cache/local/preseeding/": ensure => directory }
+ define preseeded_package ($content = "", $ensure = "installed") {
+ $seedfile = "/var/cache/local/preseeding/$name.seeds"
+ $real_content = $content ? {
+ "" => template ( "$debian_version/$name.seeds" ),
+ Default => $content
+ }
+
+ file{ $seedfile:
+ content => $real_content,
+ mode => 0600, owner => root, group => root,
+ }
+
+ package { $name:
+ ensure => $ensure,
+ responsefile => $seedfile,
+ require => File[$seedfile],
+ }
+ }
+}
class dselect {
# suppress annoying help texts of dselect