pf-tools commit: r591 [ccaillet-guest] - in /trunk: debian/changelog lib/PFTools/Net.pm sbin/mk_pxelinuxcfg

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Thu Apr 17 11:50:03 UTC 2008


Author: ccaillet-guest
Date: Thu Apr 17 11:50:03 2008
New Revision: 591

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=591
Log:
* Adding preseedfilename on Net.pm for handling preseed file for
  standard debian-installer when using Add_server
* Adding preseedfilename handler in mk_pxelinuxcfg for including it when
  debian-installer is used. Adding automated md5sum on this file
* Fixing pxetemplate for debian-installer

Modified:
    trunk/debian/changelog
    trunk/lib/PFTools/Net.pm
    trunk/sbin/mk_pxelinuxcfg

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=591&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Thu Apr 17 11:50:03 2008
@@ -41,6 +41,11 @@
   * Creating a hash on Conf.pm for storing vars defined on configuration
     files. Typically used for UML or VMWARE
   * Fix warning on possible uninitialized value on Conf.pm
+  * Adding preseedfilename on Net.pm for handling preseed file for
+    standard debian-installer when using Add_server
+  * Adding preseedfilename handler in mk_pxelinuxcfg for including it when
+    debian-installer is used. Adding automated md5sum on this file
+  * Fixing pxetemplate for debian-installer
 
   [ Thomas Parmelan ]
   * lib-net: if no comment is specified in a zone, network or server
@@ -53,7 +58,7 @@
   * Merge the remaining changes from 0.32.47-1 and 0.32.48-1.
   * Bugfix for hosts without shortname definition.
 
- -- Christophe Caillet <quadchris at free.fr>  Tue, 18 Mar 2008 16:58:11 +0100
+ -- Christophe Caillet <quadchris at free.fr>  Thu, 17 Apr 2008 13:44:32 +0200
 
 pf-tools (0.32.48-1) unstable; urgency=low
 

Modified: trunk/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Net.pm?rev=591&op=diff
==============================================================================
--- trunk/lib/PFTools/Net.pm (original)
+++ trunk/lib/PFTools/Net.pm Thu Apr 17 11:50:03 2008
@@ -913,6 +913,7 @@
 		'vmwfilename',
 		'pxelinuxconf',
 		'pxetemplate',
+		'preseedfilename',
 		'dns',
 		'initrd',
 		'cmdline',

Modified: trunk/sbin/mk_pxelinuxcfg
URL: http://svn.debian.org/wsvn/pf-tools/trunk/sbin/mk_pxelinuxcfg?rev=591&op=diff
==============================================================================
--- trunk/sbin/mk_pxelinuxcfg (original)
+++ trunk/sbin/mk_pxelinuxcfg Thu Apr 17 11:50:03 2008
@@ -24,8 +24,21 @@
 use strict;
 use warnings;
 
+use Digest::MD5;
 use PFTools::Net;
 use PFTools::Update;
+
+my $DEPLOY_DOCROOT = "/var/www";
+
+sub Get_MD5SUM_from_preseedfilename ($) {
+	my ( $filename ) = @_;
+	my ( $md5, $hdl );
+	
+	$md5 = Digest::MD5->new;
+	open $hdl, $DEPLOY_DOCROOT."/".$filename || return undef;
+	$md5->addfile ( $hdl );
+	return $md5->hexdigest;
+}
 
 sub Mk_pxe_bootfile ($;$) {
 	my ( $Z, $default_template ) = @_;
@@ -98,6 +111,15 @@
 
 							$temptemplatecontent =~ s/%KERNEL%/$M->{pxefilename}/gs;
 							$temptemplatecontent =~ s/%INITRD%/$M->{initrd}/gs;
+							
+							if ( defined $M->{'preseedfilename'} ) {
+								$temptemplatecontent =~ s/%PRESEED_URL%/http:\/\/deploy.private\/$M->{preseedfilename}/gs;
+								my $preseed_md5 = Get_MD5SUM_from_preseedfilename ( $M->{'preseedfilename'} );
+								if ( ! defined $preseed_md5 ) {
+									die "Unable to get md5dum for preseed filename ".$M->{'preseedfilename'}." for host ".$m."\n" ;
+								}
+								$temptemplatecontent =~ s/%PRESEED_MD5%/$preseed_md5/gs;
+							}
 
  							my $ramdisk_size = Get_Ramdisk_size_from_Initrd($M->{'initrd'} );
 							$temptemplatecontent =~ s/%RAMDISK_SIZE%/$ramdisk_size/gs;




More information about the pf-tools-commits mailing list