mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	code format in debian.pm
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13469 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -10,7 +10,6 @@ use Sys::Syslog; | ||||
| use File::Temp qw/tempdir/; | ||||
| use xCAT::Table; | ||||
| use xCAT::Utils; | ||||
| use xCAT::TableUtils; | ||||
| use xCAT::SvrUtils; | ||||
| use xCAT::MsgUtils; | ||||
| use Data::Dumper; | ||||
| @@ -423,151 +422,161 @@ sub mkinstall | ||||
|     { | ||||
|         my $os; | ||||
|         my $arch; | ||||
| 	my $darch; | ||||
|         my $darch; | ||||
|         my $profile; | ||||
|         my $tmplfile; | ||||
|         my $pkgdir; | ||||
| 	my $pkglistfile; | ||||
| 	my $imagename; | ||||
| 	my $platform; | ||||
|         my $pkglistfile; | ||||
|         my $imagename; | ||||
|         my $platform; | ||||
|  | ||||
|         my $osinst; | ||||
|         my $ent = $osents{$node}->[0]; #$ostab->getNodeAttribs($node, ['profile', 'os', 'arch']); | ||||
|         if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) { | ||||
| 	    $imagename=$ent->{provmethod}; | ||||
| 	    #print "imagename=$imagename\n"; | ||||
| 	    if (!exists($img_hash{$imagename})) { | ||||
| 		if (!$osimagetab) { | ||||
| 		    $osimagetab=xCAT::Table->new('osimage', -create=>1); | ||||
| 		} | ||||
| 		(my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod'); | ||||
| 		if ($ref) { | ||||
| 		    $img_hash{$imagename}->{osver}=$ref->{'osvers'}; | ||||
| 		    $img_hash{$imagename}->{osarch}=$ref->{'osarch'}; | ||||
| 		    $img_hash{$imagename}->{profile}=$ref->{'profile'}; | ||||
| 		    $img_hash{$imagename}->{provmethod}=$ref->{'provmethod'}; | ||||
| 		    if (!$linuximagetab) { | ||||
| 			$linuximagetab=xCAT::Table->new('linuximage', -create=>1); | ||||
| 		    } | ||||
| 		    (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir', 'pkglist'); | ||||
| 		    if ($ref1) { | ||||
| 			if ($ref1->{'template'}) { | ||||
| 			    $img_hash{$imagename}->{template}=$ref1->{'template'}; | ||||
| 			} | ||||
| 			if ($ref1->{'pkgdir'}) { | ||||
| 			    $img_hash{$imagename}->{pkgdir}=$ref1->{'pkgdir'}; | ||||
| 			} | ||||
| 			if ($ref1->{'pkglist'}) { | ||||
| 			    $img_hash{$imagename}->{pkglist}=$ref1->{'pkglist'}; | ||||
| 			} | ||||
| 		    } | ||||
| 		    # if the install template wasn't found, then lets look for it in the default locations. | ||||
| 		    unless($img_hash{$imagename}->{template}){ | ||||
| 	                my $pltfrm=xCAT_plugin::debian::getplatform($ref->{'osvers'}); | ||||
| 	    		my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$pltfrm",  | ||||
| 		 			$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 	    		if (! $tmplfile) { $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$::XCATROOT/share/xcat/install/$pltfrm",  | ||||
| 		 			$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 					 } | ||||
| 			# if we managed to find it, put it in the hash: | ||||
| 			if($tmplfile){ | ||||
| 			    $img_hash{$imagename}->{template}=$tmplfile; | ||||
| 			} | ||||
| 		    } | ||||
| 	        $imagename=$ent->{provmethod}; | ||||
| 	        #print "imagename=$imagename\n"; | ||||
| 	        if (!exists($img_hash{$imagename})) { | ||||
| 		        if (!$osimagetab) { | ||||
| 		            $osimagetab=xCAT::Table->new('osimage', -create=>1); | ||||
| 		        } | ||||
| 		        (my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod'); | ||||
| 		        if ($ref) { | ||||
| 		            $img_hash{$imagename}->{osver}=$ref->{'osvers'}; | ||||
| 		            $img_hash{$imagename}->{osarch}=$ref->{'osarch'}; | ||||
| 		            $img_hash{$imagename}->{profile}=$ref->{'profile'}; | ||||
| 		            $img_hash{$imagename}->{provmethod}=$ref->{'provmethod'}; | ||||
| 		            if (!$linuximagetab) { | ||||
| 			            $linuximagetab=xCAT::Table->new('linuximage', -create=>1); | ||||
| 		            } | ||||
| 		            (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir', 'pkglist'); | ||||
| 		            if ($ref1) { | ||||
| 			            if ($ref1->{'template'}) { | ||||
| 			                $img_hash{$imagename}->{template}=$ref1->{'template'}; | ||||
| 			            } | ||||
| 			            if ($ref1->{'pkgdir'}) { | ||||
| 			                $img_hash{$imagename}->{pkgdir}=$ref1->{'pkgdir'}; | ||||
| 			            } | ||||
| 			            if ($ref1->{'pkglist'}) { | ||||
| 			                 $img_hash{$imagename}->{pkglist}=$ref1->{'pkglist'}; | ||||
| 			            } | ||||
| 		            } | ||||
| 		            # if the install template wasn't found, then lets look for it in the default locations. | ||||
| 		            unless($img_hash{$imagename}->{template}){ | ||||
| 	                    my $pltfrm=getplatform($ref->{'osvers'}); | ||||
| 	    		        my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$pltfrm",  | ||||
| 		 			         $ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 	    		        if (! $tmplfile) { | ||||
|                             $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$::XCATROOT/share/xcat/install/$pltfrm",  | ||||
| 		 			          $ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 		                } | ||||
| 			            # if we managed to find it, put it in the hash: | ||||
| 			            if($tmplfile){ | ||||
| 			                $img_hash{$imagename}->{template}=$tmplfile; | ||||
| 			            } | ||||
| 		            } | ||||
|                     #if the install pkglist wasn't found, then lets look for it in the default locations | ||||
| 			unless($img_hash{$imagename}->{pkglist}){ | ||||
| 					my $pltfrm=xCAT_plugin::anaconda::getplatform($ref->{'osvers'}); | ||||
| 				my $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$pltfrm",  | ||||
| 					$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 				if (! $pkglistfile) { $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$::XCATROOT/share/xcat/install/$pltfrm",  | ||||
| 					$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 					 }	    | ||||
| 			# if we managed to find it, put it in the hash: | ||||
| 			if($pkglistfile){ | ||||
| 				$img_hash{$imagename}->{pkglist}=$pkglistfile; | ||||
| 			}	    | ||||
| 			} | ||||
| 		} else { | ||||
| 		    $callback->( | ||||
| 			{error     => ["The os image $imagename does not exists on the osimage table for $node"], | ||||
| 			 errorcode => [1]}); | ||||
| 		    next; | ||||
| 		} | ||||
| 	    } | ||||
| 	    my $ph=$img_hash{$imagename}; | ||||
| 	    $os = $ph->{osver}; | ||||
| 	    $arch  = $ph->{osarch}; | ||||
| 	    $profile = $ph->{profile}; | ||||
| 	    $platform=xCAT_plugin::debian::getplatform($os); | ||||
| 			        unless($img_hash{$imagename}->{pkglist}){ | ||||
| 				        my $pltfrm=getplatform($ref->{'osvers'}); | ||||
| 				        my $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$pltfrm",  | ||||
| 					             $ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 				        if (! $pkglistfile) { | ||||
|                             $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$::XCATROOT/share/xcat/install/$pltfrm",  | ||||
| 					             $ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); | ||||
| 				        }	    | ||||
| 			            # if we managed to find it, put it in the hash: | ||||
| 			            if($pkglistfile){ | ||||
| 				            $img_hash{$imagename}->{pkglist}=$pkglistfile; | ||||
| 			            }	    | ||||
| 			        } | ||||
| 		        } | ||||
|                 else { | ||||
| 		            $callback->( | ||||
| 			            {error     => ["The os image $imagename does not exists on the osimage table for $node"], | ||||
| 			             errorcode => [1]}); | ||||
| 		            next; | ||||
| 		        } | ||||
| 	        } | ||||
| 	        my $ph=$img_hash{$imagename}; | ||||
| 	        $os = $ph->{osver}; | ||||
| 	        $arch  = $ph->{osarch}; | ||||
| 	        $profile = $ph->{profile}; | ||||
| 	        $platform=xCAT_plugin::debian::getplatform($os); | ||||
| 	 | ||||
| 	    $tmplfile=$ph->{template}; | ||||
|     	    $tmplfile=$ph->{template}; | ||||
|             $pkgdir=$ph->{pkgdir}; | ||||
| 	    if (!$pkgdir) { | ||||
| 		$pkgdir="$installroot/$os/$arch"; | ||||
| 	        if (!$pkgdir) { | ||||
| 		        $pkgdir="$installroot/$os/$arch"; | ||||
| 	        } | ||||
| 		    $pkglistfile=$ph->{pkglist}; | ||||
| 	    } | ||||
| 		$pkglistfile=$ph->{pkglist}; | ||||
| 	} | ||||
| 	else { | ||||
| 	    $os = $ent->{os}; | ||||
| 	    $arch    = $ent->{arch}; | ||||
| 	    $profile = $ent->{profile}; | ||||
| 	    $platform=xCAT_plugin::debian::getplatform($os); | ||||
| 	    my $genos = $os; | ||||
| 	    $genos =~ s/\..*//; | ||||
| 	    else { | ||||
| 	        $os = $ent->{os}; | ||||
| 	        $arch    = $ent->{arch}; | ||||
| 	        $profile = $ent->{profile}; | ||||
| 	        $platform=xCAT_plugin::debian::getplatform($os); | ||||
| 	        my $genos = $os; | ||||
| 	        $genos =~ s/\..*//; | ||||
| 	     | ||||
| 	    $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos); | ||||
| 	    if (! $tmplfile) { $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$::XCATROOT/share/xcat/install/$platform", $profile, $os, $arch, $genos); } | ||||
| 	        $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos); | ||||
| 	        if (! $tmplfile) { | ||||
|                 $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$::XCATROOT/share/xcat/install/$platform", $profile, $os, $arch, $genos);  | ||||
|             } | ||||
|  | ||||
| 		$pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos); | ||||
| 		if (! $pkglistfile) { $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$::XCATROOT/share/xcat/install/$platform", $profile, $os, $arch, $genos); } | ||||
| 		    $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos); | ||||
| 		    if (! $pkglistfile) { | ||||
|                 $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$::XCATROOT/share/xcat/install/$platform", $profile, $os, $arch, $genos);  | ||||
|             } | ||||
|  | ||||
| 	    $pkgdir="$installroot/$os/$arch"; | ||||
| 	} | ||||
| 	        $pkgdir="$installroot/$os/$arch"; | ||||
| 	    } | ||||
|  | ||||
|         if ($arch eq "x86_64") { | ||||
|             $darch = "amd64"; | ||||
|         } elsif ($arch eq "x86") { | ||||
|         }  | ||||
|         elsif ($arch eq "x86") { | ||||
|             $darch = "i386"; | ||||
|         } else { | ||||
|         } | ||||
|         else { | ||||
|             xCAT::MsgUtils->message("S","debian.pm: Unknown arch ($arch)"); | ||||
|             $darch = $arch; | ||||
|         } | ||||
|  | ||||
|         my @missingparms; | ||||
|         unless ($os) { | ||||
| 	    if ($imagename) { push @missingparms,"osimage.osvers";  } | ||||
|             else { push @missingparms,"nodetype.os";} | ||||
| 	        if ($imagename) {  | ||||
|                 push @missingparms,"osimage.osvers";   | ||||
|             } | ||||
|             else { | ||||
|                 push @missingparms,"nodetype.os"; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         unless ($arch) { | ||||
| 	    if ($imagename) { push @missingparms,"osimage.osarch";  } | ||||
|             else { push @missingparms,"nodetype.arch";} | ||||
|             if ($imagename) { | ||||
|                 push @missingparms,"osimage.osarch";   | ||||
|             } | ||||
|             else { | ||||
|                 push @missingparms,"nodetype.arch"; | ||||
|             } | ||||
|         } | ||||
|         unless ($profile) { | ||||
| 	    if ($imagename) { push @missingparms,"osimage.profile";  } | ||||
|             else { push @missingparms,"nodetype.profile";} | ||||
| 	        if ($imagename) { | ||||
|                 push @missingparms,"osimage.profile";   | ||||
|             } | ||||
|             else { | ||||
|                 push @missingparms,"nodetype.profile"; | ||||
|             } | ||||
|         } | ||||
|         unless ($os and $arch and $profile) | ||||
|         { | ||||
|             $callback->( | ||||
|                         { | ||||
|                          error => ["Missing ".join(',',@missingparms)." for $node"], | ||||
|                          errorcode => [1] | ||||
|                         } | ||||
|                         ); | ||||
|          | ||||
|         unless ($os and $arch and $profile){ | ||||
|             $callback->({error => ["Missing ".join(',',@missingparms)." for $node"], | ||||
|                          errorcode => [1]}); | ||||
|             next;    #No profile | ||||
|         } | ||||
|  | ||||
|         unless ( -r "$tmplfile")   | ||||
|         { | ||||
|             $callback->( | ||||
|                         { | ||||
|                          error => [ | ||||
|                                    "No $platform preseed template exists for " | ||||
|                                      . $profile | ||||
|                          ], | ||||
|                          errorcode => [1] | ||||
|                         } | ||||
|                         ); | ||||
|         unless ( -r "$tmplfile") { | ||||
|             $callback->({error => ["No $platform preseed template exists for " . $profile], | ||||
|                          errorcode => [1]}); | ||||
|             next; | ||||
|         } | ||||
|  | ||||
| @@ -575,57 +584,47 @@ sub mkinstall | ||||
|         my $tmperr; | ||||
|         my $preerr; | ||||
|         my $posterr; | ||||
| 	if ($imagename) { | ||||
| 	    $tmperr="Unable to find template file: $tmplfile"; | ||||
| 	} else { | ||||
|           $tmperr="Unable to find template in $installroot/custom/install/$platform or $::XCATROOT/share/xcat/install/$platform (for $profile/$os/$arch combination)"; | ||||
| 	} | ||||
|         if (-r "$tmplfile") | ||||
|         { | ||||
| 	    if ($imagename) { | ||||
| 	        $tmperr="Unable to find template file: $tmplfile"; | ||||
| 	    } else { | ||||
|             $tmperr="Unable to find template in $installroot/custom/install/$platform or $::XCATROOT/share/xcat/install/$platform (for $profile/$os/$arch combination)"; | ||||
| 	    } | ||||
|         if (-r "$tmplfile") { | ||||
|             $tmperr = | ||||
|               xCAT::Template->subvars( | ||||
|                     $tmplfile, | ||||
|                     "$installroot/autoinst/" . $node, | ||||
|                     $node, | ||||
| 			$pkglistfile, | ||||
| 			"", | ||||
| 			$platform | ||||
|                     ); | ||||
|                xCAT::Template->subvars( | ||||
|                 $tmplfile, | ||||
|                 "$installroot/autoinst/" . $node, | ||||
|                 $node, | ||||
| 	    		$pkglistfile, | ||||
| 		    	"", | ||||
| 			    $platform | ||||
|                 ); | ||||
|         } | ||||
|  | ||||
| 	my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform"; | ||||
| 	my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform"; | ||||
| 	    my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform"; | ||||
| 	    my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform"; | ||||
|  | ||||
| 	if (-r "$prescript") | ||||
| 	{ | ||||
| 	    if (-r "$prescript"){ | ||||
|             $preerr = | ||||
|               xCAT::Template->subvars( | ||||
|                     $prescript, | ||||
|                     "$installroot/autoinst/" . $node . ".pre", | ||||
|                     $node | ||||
|                     ); | ||||
| 	 | ||||
| 	} | ||||
| 	if (-r "$postscript") | ||||
| 	{ | ||||
|                 $prescript, | ||||
|                 "$installroot/autoinst/" . $node . ".pre", | ||||
|                 $node | ||||
|                 ); | ||||
| 	    } | ||||
| 	    if (-r "$postscript") { | ||||
|             $posterr = | ||||
|               xCAT::Template->subvars( | ||||
|                     $postscript, | ||||
|                     "$installroot/autoinst/" . $node . ".post", | ||||
|                     $node | ||||
|                     ); | ||||
|                 $postscript, | ||||
|                 "$installroot/autoinst/" . $node . ".post", | ||||
|                 $node | ||||
|                 ); | ||||
|         } | ||||
|  | ||||
|         my $errtmp; | ||||
|  | ||||
|         if ($errtmp=$tmperr or $errtmp=$preerr or $errtmp=$posterr) | ||||
|         { | ||||
|             $callback->( | ||||
|                     { | ||||
|                      node => | ||||
|                        [{name => [$node], error => [$errtmp], errorcode => [1]}] | ||||
|                     } | ||||
|                     ); | ||||
|         if ($errtmp=$tmperr or $errtmp=$preerr or $errtmp=$posterr){ | ||||
|             $callback->({node =>[{name => [$node], error => [$errtmp], errorcode => [1]}]}); | ||||
|             next; | ||||
|         } | ||||
|         my $tftpdir = "/tftpboot"; | ||||
| @@ -639,27 +638,22 @@ sub mkinstall | ||||
|  | ||||
|         if ( | ||||
| 	       ( | ||||
|                  $arch =~ /x86/ and | ||||
| 		 ( | ||||
|                     ( | ||||
|                          -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux" | ||||
|                          and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux" | ||||
|                          and -r "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz" | ||||
|                          and $initrdpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz" | ||||
|                $arch =~ /x86/ and | ||||
| 		       ( | ||||
|                     ( -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux" | ||||
|                       and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux" | ||||
|                       and -r "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz" | ||||
|                       and $initrdpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz" | ||||
|                     ) or  | ||||
| 		    ( | ||||
|                          -r "$pkgdir/install/netboot/vmlinuz" | ||||
|                          and $kernpath = "$pkgdir/install/netboot/vmlinuz" | ||||
|                          and -r "$pkgdir/install/netboot/initrd.gz" | ||||
|                          and $initrdpath = "$pkgdir/install/netboot/initrd.gz" | ||||
|  | ||||
| 		    ) | ||||
| 		 ) | ||||
|  | ||||
| 		) | ||||
|           ) | ||||
|         { | ||||
| 		            ( -r "$pkgdir/install/netboot/vmlinuz" | ||||
|                       and $kernpath = "$pkgdir/install/netboot/vmlinuz" | ||||
|                       and -r "$pkgdir/install/netboot/initrd.gz" | ||||
|                       and $initrdpath = "$pkgdir/install/netboot/initrd.gz" | ||||
|                     ) | ||||
| 		       ) | ||||
|  | ||||
| 		   ) | ||||
|        ){ | ||||
|             #TODO: driver slipstream, targetted for network. | ||||
|             unless ($doneimgs{"$os|$arch"}) | ||||
|             { | ||||
| @@ -671,10 +665,10 @@ sub mkinstall | ||||
|  | ||||
|             #We have a shot... | ||||
|             my $ent    = $rents{$node}->[0]; | ||||
| #              $restab->getNodeAttribs($node, | ||||
| #           $restab->getNodeAttribs($node, | ||||
| #                                     ['nfsserver', 'primarynic', 'installnic']); | ||||
|             my $sent = $hents{$node}->[0]; | ||||
| #              $hmtab->getNodeAttribs( | ||||
| #           $hmtab->getNodeAttribs( | ||||
| #                                     $node, | ||||
| #                                     [ | ||||
| #                                      'serialport', 'serialspeed', 'serialflow' | ||||
| @@ -682,16 +676,11 @@ sub mkinstall | ||||
| #                                     ); | ||||
|             unless ($ent and $ent->{nfsserver}) | ||||
|             { | ||||
|                 $callback->( | ||||
|                         { | ||||
|                          error => ["No noderes.nfsserver defined for " . $node], | ||||
|                          errorcode => [1] | ||||
|                         } | ||||
|                         ); | ||||
|                 $callback->({error => ["No noderes.nfsserver defined for " . $node], | ||||
|                              errorcode => [1]}); | ||||
|                 next; | ||||
|             } | ||||
| 	    #if ($platform eq "ubuntu") | ||||
| 	    #{ | ||||
| 	        #if ($platform eq "ubuntu"){ | ||||
|             #    my $kcmdline = | ||||
|             #        "nofb utf8 auto url=http://" | ||||
|             #      . $ent->{nfsserver} | ||||
| @@ -699,8 +688,7 @@ sub mkinstall | ||||
|             #      . $node; | ||||
|             #} else  | ||||
| 	    #{ | ||||
|                 my $kcmdline = | ||||
|                     "nofb utf8 auto url=http://" | ||||
|             my $kcmdline = "nofb utf8 auto url=http://" | ||||
|                   . $ent->{nfsserver} | ||||
|                   . "$installroot/autoinst/" | ||||
|                   . $node; | ||||
| @@ -710,68 +698,46 @@ sub mkinstall | ||||
|                 $kcmdline.=" mem=$maxmem"; | ||||
|             } | ||||
|             my $ksdev = ""; | ||||
|             if ($ent->{installnic}) | ||||
|             { | ||||
|                 if ($ent->{installnic} eq "mac") | ||||
|                 { | ||||
|             if ($ent->{installnic}){ | ||||
|                 if ($ent->{installnic} eq "mac"){ | ||||
|                     my $mactab = xCAT::Table->new("mac"); | ||||
|                     my $macref = $mactab->getNodeAttribs($node, ['mac']); | ||||
|                     $ksdev = $macref->{mac}; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                 else{ | ||||
|                     $ksdev = $ent->{installnic}; | ||||
|                 } | ||||
|             } | ||||
|             elsif ($ent->{primarynic}) | ||||
|             { | ||||
|                 if ($ent->{primarynic} eq "mac") | ||||
|                 { | ||||
|             elsif ($ent->{primarynic}){ | ||||
|                 if ($ent->{primarynic} eq "mac"){ | ||||
|                     my $mactab = xCAT::Table->new("mac"); | ||||
|                     my $macref = $mactab->getNodeAttribs($node, ['mac']); | ||||
|                     $ksdev = $macref->{mac}; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                 else{ | ||||
|                     $ksdev = $ent->{primarynic}; | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|             else{ | ||||
|                 $ksdev = "eth0"; | ||||
|             } | ||||
|             if ($ksdev eq "") | ||||
|             { | ||||
|                 $callback->( | ||||
|                         { | ||||
|                          error => ["No MAC address defined for " . $node], | ||||
|                          errorcode => [1] | ||||
|                         } | ||||
|                         ); | ||||
|              } | ||||
|              $kcmdline .= " netcfg/choose_interface=" . $ksdev; | ||||
|              | ||||
|             if ($ksdev eq ""){ | ||||
|                 $callback->({error => ["No MAC address defined for " . $node], | ||||
|                              errorcode => [1]}); | ||||
|             } | ||||
|             $kcmdline .= " netcfg/choose_interface=" . $ksdev; | ||||
|  | ||||
|             #TODO: dd=<url> for driver disks | ||||
|             if (defined($sent->{serialport})) | ||||
|             { | ||||
|                 unless ($sent->{serialspeed}) | ||||
|                 { | ||||
|                     $callback->( | ||||
|                         { | ||||
|                          error => [ | ||||
|                              "serialport defined, but no serialspeed for $node in nodehm table" | ||||
|                          ], | ||||
|                          errorcode => [1] | ||||
|                         } | ||||
|                         ); | ||||
|             if (defined($sent->{serialport})){ | ||||
|                 unless ($sent->{serialspeed}){ | ||||
|                     $callback->({error => ["serialport defined, but no serialspeed for $node in nodehm table"], | ||||
|                                  errorcode => [1]}); | ||||
|                     next; | ||||
|                 } | ||||
|                 $kcmdline .= | ||||
|                     " console=tty0 console=ttyS" | ||||
|                   . $sent->{serialport} . "," | ||||
|                   . $sent->{serialspeed}; | ||||
|                 if ($sent->{serialflow} =~ /(hard|cts|ctsrts)/) | ||||
|                 { | ||||
|                 $kcmdline .= " console=tty0 console=ttyS" | ||||
|                   . $sent->{serialport} . "," . $sent->{serialspeed}; | ||||
|                 if ($sent->{serialflow} =~ /(hard|cts|ctsrts)/){ | ||||
|                     $kcmdline .= "n8r"; | ||||
|                 } | ||||
|             } | ||||
| @@ -786,28 +752,28 @@ sub mkinstall | ||||
|             #} | ||||
|  | ||||
|             # need to add these in, otherwise aptitude will ask questions | ||||
| 	    $kcmdline .= " locale=en_US console-setup/layoutcode=us"; | ||||
| 	    #$kcmdline .= " netcfg/wireless_wep= netcfg/get_hostname= netcfg/get_domain="; | ||||
| 	        $kcmdline .= " locale=en_US console-setup/layoutcode=us"; | ||||
| 	        #$kcmdline .= " netcfg/wireless_wep= netcfg/get_hostname= netcfg/get_domain="; | ||||
| 	     | ||||
|             # default answers as much as possible, we don't want any interactiveness :) | ||||
| 	    $kcmdline .= " priority=critical"; | ||||
| 	        $kcmdline .= " priority=critical"; | ||||
|  | ||||
|             # Automatically detect all HDD | ||||
| 	    #$kcmdline .= " all-generic-ide irqpoll"; | ||||
| 	        #$kcmdline .= " all-generic-ide irqpoll"; | ||||
|  | ||||
| 	    # by default do text based install | ||||
| 	    #$kcmdline .= " DEBIAN_FRONTEND=text"; | ||||
| 	        # by default do text based install | ||||
| 	        #$kcmdline .= " DEBIAN_FRONTEND=text"; | ||||
|  | ||||
| 	    # Maybe useful for debugging purposes | ||||
| 	    # | ||||
| 	    #$kcmdline .= " BOOT_DEBUG=3"; | ||||
| 	    #$kcmdline .= " DEBCONF_DEBUG=5"; | ||||
| 	        # Maybe useful for debugging purposes | ||||
| 	        # | ||||
| 	        #$kcmdline .= " BOOT_DEBUG=3"; | ||||
| 	        #$kcmdline .= " DEBCONF_DEBUG=5"; | ||||
|  | ||||
| 	    # I don't need the timeout for ubuntu, but for debian there is a problem with getting dhcp in a timely manner | ||||
| 	    $kcmdline .= " netcfg/dhcp_timeout=120"; | ||||
| 	        # I don't need the timeout for ubuntu, but for debian there is a problem with getting dhcp in a timely manner | ||||
| 	        $kcmdline .= " netcfg/dhcp_timeout=120"; | ||||
|  | ||||
|      # safer way to set hostname, avoid problems with nameservers | ||||
|      $kcmdline .= " hostname=".$node; | ||||
|             # safer way to set hostname, avoid problems with nameservers | ||||
|             $kcmdline .= " hostname=".$node; | ||||
|  | ||||
|             $bptab->setNodeAttribs( | ||||
|                                    $node, | ||||
| @@ -818,14 +784,9 @@ sub mkinstall | ||||
|                                    } | ||||
|                                    ); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             $callback->( | ||||
|                     { | ||||
|                      error => ["Install image not found in $installroot/$os/$arch"], | ||||
|                      errorcode => [1] | ||||
|                     } | ||||
|                     ); | ||||
|         else{ | ||||
|             $callback->({error => ["Install image not found in $installroot/$os/$arch"], | ||||
|                          errorcode => [1]}); | ||||
|         } | ||||
|     } | ||||
|     #my $rc = xCAT::TableUtils->create_postscripts_tar(); | ||||
| @@ -1433,13 +1394,11 @@ sub mknetboot | ||||
| sub getplatform { | ||||
|     my $os=shift; | ||||
|     my $platform; | ||||
|     if ($os =~ /debian.*/)  | ||||
|     { | ||||
| 	$platform = "debian"; | ||||
|     if ($os =~ /debian.*/) { | ||||
| 	    $platform = "debian"; | ||||
|     } | ||||
|     elsif ($os =~ /ubuntu.*/) | ||||
|     { | ||||
| 	$platform = "ubuntu"; | ||||
|     elsif ($os =~ /ubuntu.*/){ | ||||
|         $platform = "ubuntu"; | ||||
|     } | ||||
|     return $platform; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user