Browse files

- add debian preseed stuff with java example

  • Loading branch information...
1 parent 4fa5b4b commit ba0f90735a03b03ecc67ce3168fdf79651d8b6c5 @jordansissel jordansissel committed May 11, 2011
Showing with 63 additions and 0 deletions.
  1. +17 −0 debian/manifests/package.pp
  2. +8 −0 debian/manifests/preseed.pp
  3. +9 −0 debian/templates/preseed.erb
  4. +10 −0 java/manifests/jdk.pp
  5. +19 −0 java/manifests/jre.pp
View
17 debian/manifests/package.pp
@@ -0,0 +1,17 @@
+define debian::package($ensure="present", $config) {
+ include ::debian::preseed
+
+ $responsefile = "$debian::preseed::basepath/$name.preseed"
+ package {
+ "$name":
+ ensure => $ensure,
+ responsefile => $responsefile,
+ require => File[$responsefile];
+ }
+
+ file {
+ $responsefile:
+ ensure => file,
+ content => template("debian/preseed.erb");
+ }
+}
View
8 debian/manifests/preseed.pp
@@ -0,0 +1,8 @@
+class debian::preseed {
+ $basepath = "/var/lib/puppet-preseed"
+
+ file {
+ $basepath:
+ ensure => directory;
+ }
+}
View
9 debian/templates/preseed.erb
@@ -0,0 +1,9 @@
+# Preseed file generated by puppet
+# Package: <%= name %>
+<% if String === config -%>
+<%= config %>
+<% elsif Array === config -%>
+<%= config.join("\n") %>
+<% else -%>
+# Unexpected type for 'config': <%= config.class %>
+<% end -%>
View
10 java/manifests/jdk.pp
@@ -0,0 +1,10 @@
+class java::jdk {
+ include ::java::jre
+
+ debian::package {
+ "sun-java6-jdk":
+ ensure => latest,
+ config => "sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true",
+ require => Class["java::jre"];
+ }
+}
View
19 java/manifests/jre.pp
@@ -0,0 +1,19 @@
+class java::jre {
+ debian::package {
+ "sun-java6-jre":
+ ensure => latest,
+ config => "sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true",
+ require => Package["sun-java6-bin"],
+ notify => Exec["use sun java"];
+ "sun-java6-bin":
+ ensure => latest,
+ config => "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true",
+ notify => Exec["use sun java"];
+ }
+
+ exec {
+ "use sun java":
+ command => "update-alternatives --set java /usr/lib/jvm/java-6-sun/jre/bin/java",
+ refreshonly => true;
+ }
+}

0 comments on commit ba0f907

Please sign in to comment.