pf-tools commit: r465 [parmelan-guest] - in /branches/0.32-stable: README.doc TODO debian/changelog install install.dist-2.6 lib-net

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Wed Apr 11 11:31:46 UTC 2007


Author: parmelan-guest
Date: Wed Apr 11 11:31:45 2007
New Revision: 465

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=465
Log:
* lib-net: new (optional) "console" directive (see README.doc for more
  information).
* install, install.dist-2.6: when creating the lilo configuration file,
  parse /proc/cmdline instead of hardcoding "console=ttyS0,115200n8").

Modified:
    branches/0.32-stable/README.doc
    branches/0.32-stable/TODO
    branches/0.32-stable/debian/changelog
    branches/0.32-stable/install
    branches/0.32-stable/install.dist-2.6
    branches/0.32-stable/lib-net

Modified: branches/0.32-stable/README.doc
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/README.doc?rev=465&op=diff
==============================================================================
--- branches/0.32-stable/README.doc (original)
+++ branches/0.32-stable/README.doc Wed Apr 11 11:31:45 2007
@@ -24,6 +24,29 @@
 	cmdline.default	= noapic
 	cmdline.0	= noapic pci=noirq
 
+* console
+
+  [optional]
+
+  If defined and not equal to 'default', the value of this directive (prefixed
+  with "console=") is substituted to %CONSOLE% in the PXE configuration file.
+  A default value can be defined in the [private] zone declaration.
+
+  Sample use :
+
+    To have a serial console by default :
+
+    [private]
+	...
+	console = ttyS0,115200n8
+
+    To cancel the serial console for host host01 :
+
+    [host%%]
+	...
+	console.1 = default
+
+
 ========================================================================
 update-* :
 

Modified: branches/0.32-stable/TODO
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/TODO?rev=465&op=diff
==============================================================================
--- branches/0.32-stable/TODO (original)
+++ branches/0.32-stable/TODO Wed Apr 11 11:31:45 2007
@@ -5,9 +5,9 @@
 UM use Net::IP for ipstart.* and check it is ok wrt the subnet declaration
 MM source = CVS:config/%HOST_TYPE%/%SECTIONNAME%
 LE Install everything in the correct directories (and ln -s for compatibility)
+LE Add %SERIAL% in addition to %CONSOLE% for PXE, if it is really interesting ("serial 0 115200" by default)
 
 UH br0/trunk sur uml (2e couche bridge?)
-NM Pouvoir spécifier si console série ou non dans private-network (ou ailleurs ?) (umlaunch + PXE)
 NM Pouvoir forcer une version particulière d'un paquet (apt-get install paquet=version)
 NM apc/serial/yasser dans private-network
 NM interface 0.0.0.0 promisc pour uml (ex: sondes)

Modified: branches/0.32-stable/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/debian/changelog?rev=465&op=diff
==============================================================================
--- branches/0.32-stable/debian/changelog (original)
+++ branches/0.32-stable/debian/changelog Wed Apr 11 11:31:45 2007
@@ -1,3 +1,12 @@
+pf-tools (0.32.47-1) unstable; urgency=low
+
+  * lib-net: new (optional) "console" directive (see README.doc for more
+    information).
+  * install, install.dist-2.6: when creating the lilo configuration file,
+    parse /proc/cmdline instead of hardcoding "console=ttyS0,115200n8").
+
+ -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org>  Wed, 11 Apr 2007 13:24:33 +0200
+
 pf-tools (0.32.46-1) unstable; urgency=low
 
   * lib-net, umlaunch: new (optional) "cmdline" directive (see README.doc for

Modified: branches/0.32-stable/install
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/install?rev=465&op=diff
==============================================================================
--- branches/0.32-stable/install (original)
+++ branches/0.32-stable/install Wed Apr 11 11:31:45 2007
@@ -574,6 +574,15 @@
 
     if ( $Mode eq $MODEHD ) {
 
+	open PROCCMDLINE, '</proc/cmdline'
+	    or die "open: /proc/cmdline: $!\n";
+	my $proc_cmdline = <PROCCMDLINE>;
+	close PROCCMDLINE;
+	my $lilo_append = '';
+	if ($proc_cmdline =~ m/\b(console=\S+)/) {
+	    $lilo_append = $1;
+	}
+
         open( LILO, "> $SLASH/etc/lilo.conf" );
         print LILO <<"# END lilo.conf" ;
 # BEGIN lilo.conf
@@ -591,13 +600,13 @@
 image=/boot/vmlinuz
 	label=Linux
 	read-only
-	append="console=ttyS0,115200n8"
+	append="$lilo_append"
 
 image=/boot/vmlinuz.old
 	label=old
 	read-only
 	optional
-	append="console=ttyS0,115200n8"
+	append="$lilo_append"
 # END lilo.conf
 
         #----------------------------------------------------------------------

Modified: branches/0.32-stable/install.dist-2.6
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/install.dist-2.6?rev=465&op=diff
==============================================================================
--- branches/0.32-stable/install.dist-2.6 (original)
+++ branches/0.32-stable/install.dist-2.6 Wed Apr 11 11:31:45 2007
@@ -663,6 +663,15 @@
 
     if ( $Mode eq $MODEHD || $Mode eq $MODERAID ) {
 
+	open PROCCMDLINE, '</proc/cmdline'
+	    or die "open: /proc/cmdline: $!\n";
+	my $proc_cmdline = <PROCCMDLINE>;
+	close PROCCMDLINE;
+	my $lilo_append = '';
+	if ($proc_cmdline =~ m/\b(console=\S+)/) {
+	    $lilo_append = $1;
+	}
+
         open( LILO, "> $SLASH/etc/lilo.conf" );
         print LILO <<"# END lilo.conf" ;
 # BEGIN lilo.conf
@@ -680,13 +689,13 @@
 image=/boot/vmlinuz
 	label=Linux
 	read-only
-	append="console=ttyS0,115200n8"
+	append="$lilo_append"
 
 image=/boot/vmlinuz.old
 	label=old
 	read-only
 	optional
-	append="console=ttyS0,115200n8"
+	append="$lilo_append"
 # END lilo.conf
 # FIXME pouvoir conditionner le console= pour faciliter le deploiement de machines
 # physiques sur les plateformes UML

Modified: branches/0.32-stable/lib-net
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.32-stable/lib-net?rev=465&op=diff
==============================================================================
--- branches/0.32-stable/lib-net (original)
+++ branches/0.32-stable/lib-net Wed Apr 11 11:31:45 2007
@@ -925,6 +925,17 @@
 		$M->{cmdline} = $S->{cmdline}->{default};
 	    }
 
+	    if ( defined( $S->{console}->{$mnamindexnum} ) ) {
+		$M->{console} = $S->{console}->{$mnamindexnum};
+	    }
+	    elsif ( defined( $S->{console}->{default} ) ) {
+		$M->{console} = $S->{console}->{default};
+	    }
+	    elsif ( defined $Z->{SOA}->{console} ) {
+		$M->{console} = $Z->{SOA}->{console};
+	    }
+	    delete $M->{console} if $M->{console} and $M->{console} eq 'default';
+
             # vrrp?
             my $vrrp;
             foreach $j ( keys %{ $S->{vrrp} } ) {
@@ -1215,6 +1226,10 @@
         @{ $Z->{SOA}->{dhcpvlan} } = @DEFAULTDHCPVLAN;
     }
 
+    if ( $S->{console} and $S->{console} ne 'default') {
+	$Z->{SOA}->{console} = $S->{console};
+    }
+
     # Ajout des champs NS
     foreach $c ( sort ( keys %{ $S->{ns} } ) ) {
         push ( @{ $Z->{NS} }, $S->{ns}->{$c} );
@@ -1455,6 +1470,10 @@
 
                         if ( $M->{cmdline} ) {
 			    printf qq{# cmdline "%s";\n}, $M->{cmdline};
+                        }
+
+                        if ( $M->{console} ) {
+			    printf qq{# console "%s";\n}, $M->{console};
                         }
 
                         if ( defined( $M->{pxefilename} )
@@ -1582,18 +1601,24 @@
                               . $pxelinuxconfdir . "/" . $hexaddr . ": " . $!;
                             my $temptemplatecontent =
                               join ( "", @templatecontent );
-                            $temptemplatecontent =~
-                              s/%KERNEL%/$M->{pxefilename}/gs;
-			    $temptemplatecontent =~
-			      s/%INITRD%/$M->{initrd}/gs;
+
+			    $temptemplatecontent =~ s/%KERNEL%/$M->{pxefilename}/gs;
+			    $temptemplatecontent =~ s/%INITRD%/$M->{initrd}/gs;
+
 			    my $ramdisk_size = Get_Ramdisk_size_from_Initrd($M->{initrd});
-			    $temptemplatecontent =~
-			      s/%RAMDISK_SIZE%/$ramdisk_size/gs;
+			    $temptemplatecontent =~ s/%RAMDISK_SIZE%/$ramdisk_size/gs;
+
 			    my $cmdline = $M->{cmdline} || '';
-			    $temptemplatecontent =~
-			      s/%CMDLINE%/$cmdline/gs;
-                            print PXELINUXCFG $temptemplatecontent;
-                            close(PXELINUXCFG);
+			    $temptemplatecontent =~ s/%CMDLINE%/$cmdline/gs;
+
+			    my $console = $M->{console} || '';
+			    $console = "console=" . $console if $console;
+			    $temptemplatecontent =~ s/%CONSOLE%/$console/gs;
+
+			    $temptemplatecontent =~ s/ +/ /gs;
+
+			    print PXELINUXCFG $temptemplatecontent;
+			    close(PXELINUXCFG);
                         }
                     }
                 }




More information about the Pf-tools-commits mailing list