generate default netboot configure file for p8 hardware discovery
This commit is contained in:
		@@ -2416,6 +2416,9 @@ sub addnet
 | 
			
		||||
        push @netent,
 | 
			
		||||
          "    } else if option client-architecture = 00:02 { #ia64\n ";
 | 
			
		||||
        push @netent, "      filename \"elilo.efi\";\n";
 | 
			
		||||
        push @netent,
 | 
			
		||||
          "    } else if option client-architecture = 00:0e { #OPAL-v3\n ";
 | 
			
		||||
        push @netent, "      option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/default\";\n";
 | 
			
		||||
        push @netent,
 | 
			
		||||
          "    } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n ";
 | 
			
		||||
        push @netent, "      filename \"/yaboot\";\n";
 | 
			
		||||
 
 | 
			
		||||
@@ -117,6 +117,7 @@ sub process_request {
 | 
			
		||||
      system("ssh-keygen -t rsa -f $tempdir/etc/ssh_host_rsa_key -C '' -N ''");
 | 
			
		||||
      system("ssh-keygen -t dsa -f $tempdir/etc/ssh_host_dsa_key -C '' -N ''");
 | 
			
		||||
   }
 | 
			
		||||
   my $initrd_file = undef;
 | 
			
		||||
   my $lzma_exit_value=1;
 | 
			
		||||
   if ($invisibletouch) {
 | 
			
		||||
       my $done=0;
 | 
			
		||||
@@ -129,18 +130,25 @@ sub process_request {
 | 
			
		||||
		unlink ("$tftpdir/xcat/genesis.fs.$arch.lzma");
 | 
			
		||||
	} else {
 | 
			
		||||
		$done = 1;
 | 
			
		||||
                $initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma";
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
		
 | 
			
		||||
       if (not $done) {
 | 
			
		||||
       $callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]});
 | 
			
		||||
       system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz");
 | 
			
		||||
       $initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz";
 | 
			
		||||
	}
 | 
			
		||||
   } else {
 | 
			
		||||
   	$callback->({data=>["Creating nbfs.$arch.gz in $tftpdir/xcat"]});
 | 
			
		||||
       system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz");
 | 
			
		||||
       $initrd_file = "$tftpdir/xcat/nbfs.$arch.gz";
 | 
			
		||||
   }
 | 
			
		||||
   system ("rm -rf $tempdir");
 | 
			
		||||
   unless ($initrd_file) {
 | 
			
		||||
       $callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]});
 | 
			
		||||
       return;
 | 
			
		||||
   }
 | 
			
		||||
   my $hexnets = xCAT::NetworkUtils->my_hexnets();
 | 
			
		||||
   my $normnets = xCAT::NetworkUtils->my_nets();
 | 
			
		||||
   my $consolecmdline;
 | 
			
		||||
@@ -170,7 +178,7 @@ sub process_request {
 | 
			
		||||
         chmod(0644,"$tftpdir/pxelinux.0");
 | 
			
		||||
      }
 | 
			
		||||
   } elsif ($arch =~ /ppc/) {
 | 
			
		||||
      mkpath("$tftpdir/etc");
 | 
			
		||||
      mkpath("$tftpdir/pxelinux.cfg/p/");
 | 
			
		||||
   }
 | 
			
		||||
   my $dopxe=0;
 | 
			
		||||
   foreach (keys %{$normnets}) {
 | 
			
		||||
@@ -262,11 +270,11 @@ sub process_request {
 | 
			
		||||
         close($cfgfile);
 | 
			
		||||
      } elsif ($arch =~ /ppc/) {
 | 
			
		||||
         open($cfgfile,">","$tftpdir/etc/".lc($_));
 | 
			
		||||
         print $cfgfile "timeout=5\n";
 | 
			
		||||
         print $cfgfile "   label=xcat\n";
 | 
			
		||||
         print $cfgfile "   image=xcat/nbk.$arch\n";
 | 
			
		||||
         print $cfgfile "   initrd=xcat/nbfs.$arch.gz\n";
 | 
			
		||||
         print $cfgfile '   append="quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n";
 | 
			
		||||
         print $cfgfile "default xCAT\n";
 | 
			
		||||
         print $cfgfile "   label xCAT\n";
 | 
			
		||||
         print $cfgfile "   kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n";
 | 
			
		||||
         print $cfgfile "   initrd http://".$hexnets->{$_}.":80/$initrd_file\n";
 | 
			
		||||
         print $cfgfile '   append "quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n";
 | 
			
		||||
         close($cfgfile);
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user