pf-tools/pf-tools-0.33-stable: * Adding directive preseedtpl

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Thu Mar 3 11:04:32 UTC 2011


details:   http://hg.debian.org/hg/pf-tools/pf-tools-0.33-stable/rev/0c5fb7513db2
changeset: 545:0c5fb7513db2
user:      "Christophe Caillet <quadchris at free.fr>"
date:      Thu Mar 03 12:04:09 2011 +0100
description:
* Adding directive preseedtpl
* Correctly handle pxetemplate directive

diffstat:

3 files changed, 16 insertions(+), 2 deletions(-)
README.doc          |   11 +++++++++++
debian/changelog    |    5 +++++
sbin/mk_pxelinuxcfg |    2 --

diffs (129 lines):

diff -r bd9b429c6d05 -r 0c5fb7513db2 README.doc
--- a/README.doc	Thu Nov 04 16:11:16 2010 +0100
+++ b/README.doc	Thu Mar 03 12:04:09 2011 +0100
@@ -246,6 +246,28 @@
 	...
 	pxetemplate.default = /path/to/my/pxe-template
 
+* preseedtpl
+
+  [optional]
+
+  If defined, the value of this directive is used as the filename of the
+  preseed template file to use for this host, instead of the default value.
+  If it is not an absolute path, the directory component of the default value
+  will be used.
+  (Note: The default value is actually hardcoded into mk_pxelinuxcfg program).
+
+  NOTE: if the value doesn't contain a slash the it concatenate the value with
+  the default directory /usr/share/pf-tools/templates
+
+  Sample use :
+
+    To use "/path/to/my/preseed-template" instead of the default value for all
+    host%% servers :
+
+    [host%%]
+	...
+	preseedtpl.default = /path/to/my/preseed-template
+
 ========================================================================
 update-* :
 
diff -r bd9b429c6d05 -r 0c5fb7513db2 debian/changelog
--- a/debian/changelog	Thu Nov 04 16:11:16 2010 +0100
+++ b/debian/changelog	Thu Mar 03 12:04:09 2011 +0100
@@ -1,3 +1,10 @@
+pf-tools (0.33.23-1) unstable; urgency=low
+
+  * Adding directive preseedtpl
+  * Correctly handle pxetemplate directive
+
+ -- Christophe Caillet <quadchris at free.fr>  Tue, 01 Mar 2011 15:26:26 +0100
+
 pf-tools (0.33.22-1) unstable; urgency=low
 
   * filters/*, sbin/*, tools/*
diff -r bd9b429c6d05 -r 0c5fb7513db2 lib/PFTools/Net.pm
--- a/lib/PFTools/Net.pm	Thu Nov 04 16:11:16 2010 +0100
+++ b/lib/PFTools/Net.pm	Thu Mar 03 12:04:09 2011 +0100
@@ -994,6 +994,7 @@
 		'vmwfilename',
 		'pxelinuxconf',
 		'pxetemplate',
+        'preseedtpl',
 		'deploymode',
 		'dns',
 		'arch',
diff -r bd9b429c6d05 -r 0c5fb7513db2 sbin/mk_pxelinuxcfg
--- a/sbin/mk_pxelinuxcfg	Thu Nov 04 16:11:16 2010 +0100
+++ b/sbin/mk_pxelinuxcfg	Thu Mar 03 12:04:09 2011 +0100
@@ -41,8 +41,9 @@
 	chmod ( oct ( $mode ), $PRESEED_REPOS ) ;
 }
 
-my $TPL_PRESEED			= "/usr/share/pf-tools/templates/standard-preseed.tpl" ;
-my $TPL_UBUNTU_PRESEED	= "/usr/share/pf-tools/templates/ubuntu-preseed.tpl" ;
+my $TPL_PRESEED_DIR     = "/usr/share/pf-tools/templates/";
+my $TPL_PRESEED			= $TPL_PRESEED_DIR."standard-preseed.tpl" ;
+my $TPL_UBUNTU_PRESEED	= $TPL_PRESEED_DIR."ubuntu-preseed.tpl" ;
 my $DEFAULT_PRESEED	= $PRESEED_REPOS."/default_preseed.txt" ;
 
 sub Get_kpkg_from_pxefilename ($$) {
@@ -172,7 +173,10 @@
 										. $!;
 
 								my $template_name ;
-								if ( $debian_installer ) {
+                                if ( $M->{'pxetemplate'} ) {
+                                    $template_name = $M->{'pxetemplate'};
+                                }
+								elsif ( $debian_installer ) {
 									if ( $M->{'deploymode'} =~ /^ubuntu/ ) {
 										$template_name = 'ubuntu-installer' ;
 									}
@@ -181,7 +185,7 @@
 									}
 								}
 								else {
-									$template_name = $M->{'pxetemplate'} ? $M->{'pxetemplate'} : $default_template;
+									$template_name = $default_template;
 								}
 
 								unless (defined $templates->{$template_name}) {
@@ -210,12 +214,29 @@
 										$temptemplatecontent =~ s/initrd=([^\s]*)%INITRD%//gs ;
 									}
 									my $preseed_file;
-									if ( $M->{'deploymode'} =~ /^ubuntu/ ) {
-										$preseed_file = Build_preseed_filename ( $m, $TPL_UBUNTU_PRESEED, $M ) ;
-									}
-									else {
-										$preseed_file = Build_preseed_filename ( $m, $TPL_PRESEED, $M ) ;
-									}
+                                    my $preseed_tpl;
+                                    if ( $M->{'preseedtpl'} ) {
+                                        $preseed_tpl =
+                                            ( $M->{'preseedtpl'} !~ /\// )
+                                            ? $TPL_PRESEED_DIR.$M->{'preseedtpl'}
+                                            : $M->{'preseedtpl'};
+                                    }
+                                    else {
+                                        $preseed_tpl =
+                                            ( $M->{'deploymode'} =~ /^ubuntu/ )
+                                            ? $TPL_UBUNTU_PRESEED
+                                            : $TPL_PRESEED;
+                                    }
+                                    $preseed_file = Build_preseed_filename (
+                                        $m, $preseed_tpl, $M
+                                    );
+#									elsif ( $M->{'deploymode'} =~ /^ubuntu/ ) {
+#                                        $preseed_tpl = $TPL_UBUNTU_PRESEED;
+#										$preseed_file = Build_preseed_filename ( $m, $TPL_UBUNTU_PRESEED, $M ) ;
+#									}
+#									else {
+#										$preseed_file = Build_preseed_filename ( $m, $TPL_PRESEED, $M ) ;
+#									}
 									# MD5sum on generated preseed file
 									$temptemplatecontent =~
 										s/%PRESEED_URL%/preseed\/$preseed_file/gs;



More information about the pf-tools-commits mailing list