install packages contained in the ubuntu distro media
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10632 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -30,6 +30,7 @@ sub subvars { | ||||
|   $node = shift; | ||||
|   my $pkglistfile=shift; | ||||
|   my $media_dir = shift; | ||||
|   my $platform=shift; | ||||
|  | ||||
|   my $outh; | ||||
|   my $inh; | ||||
| @@ -80,6 +81,36 @@ sub subvars { | ||||
|       $inc =~ s/#INCLUDE_DEFAULT_RMPKGLIST_S#/#INCLUDE_RMPKGLIST:$pkglistfile#/g; | ||||
|   } | ||||
|  | ||||
|   if (("ubuntu" eq $platform) || ("debian" eq $platform)) { | ||||
|     # since debian/ubuntu uses a preseed file instead of a kickstart file, pkglist | ||||
|     # must be included via simple string replacement instead of using includefile() | ||||
|  | ||||
|     # the first line of $pkglistfile is the space-delimited package list | ||||
|     # the additional lines are considered preseed directives and included as is | ||||
|  | ||||
|     if ($pkglistfile) { | ||||
|       # handle empty and non-empty $pkglistfile's | ||||
|  | ||||
|       if (open PKGLISTFILE, "<$pkglistfile") { | ||||
|         my $pkglist = <PKGLISTFILE>; | ||||
|         chomp $pkglist; | ||||
|  | ||||
|         # substitute space-delimited package list | ||||
|         $inc =~ s/#INCLUDE_DEFAULT_PKGLIST_PRESEED#/$pkglist/g; | ||||
|  | ||||
|         # append preseed directive lines | ||||
|         while (<PKGLISTFILE>) { | ||||
|           $inc .= $_; | ||||
|         } | ||||
|  | ||||
|         close PKGLISTFILE; | ||||
|       } | ||||
|     } else { | ||||
|       # handle no $pkglistfile | ||||
|       $inc =~ s/#INCLUDE_DEFAULT_PKGLIST_PRESEED#//g; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   #do *all* includes, recursive and all | ||||
|   my $doneincludes=0; | ||||
|   while (not $doneincludes) { | ||||
|   | ||||
| @@ -400,6 +400,7 @@ sub mkinstall | ||||
|         my $profile; | ||||
|         my $tmplfile; | ||||
|         my $pkgdir; | ||||
| 	my $pkglistfile; | ||||
| 	my $imagename; | ||||
| 	my $platform; | ||||
|  | ||||
| @@ -421,7 +422,7 @@ sub mkinstall | ||||
| 		    if (!$linuximagetab) { | ||||
| 			$linuximagetab=xCAT::Table->new('linuximage', -create=>1); | ||||
| 		    } | ||||
| 		    (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir'); | ||||
| 		    (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir', 'pkglist'); | ||||
| 		    if ($ref1) { | ||||
| 			if ($ref1->{'template'}) { | ||||
| 			    $img_hash{$imagename}->{template}=$ref1->{'template'}; | ||||
| @@ -429,6 +430,9 @@ sub mkinstall | ||||
| 			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}){ | ||||
| @@ -443,6 +447,19 @@ sub mkinstall | ||||
| 			    $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"], | ||||
| @@ -461,6 +478,7 @@ sub mkinstall | ||||
| 	    if (!$pkgdir) { | ||||
| 		$pkgdir="$installroot/$os/$arch"; | ||||
| 	    } | ||||
| 		$pkglistfile=$ph->{pkglist}; | ||||
| 	} | ||||
| 	else { | ||||
| 	    $os = $ent->{os}; | ||||
| @@ -473,6 +491,9 @@ sub mkinstall | ||||
| 	    $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); } | ||||
|  | ||||
| 	    $pkgdir="$installroot/$os/$arch"; | ||||
| 	} | ||||
|  | ||||
| @@ -538,7 +559,10 @@ sub mkinstall | ||||
|               xCAT::Template->subvars( | ||||
|                     $tmplfile, | ||||
|                     "$installroot/autoinst/" . $node, | ||||
|                     $node | ||||
|                     $node, | ||||
| 			$pkglistfile, | ||||
| 			"", | ||||
| 			$platform | ||||
|                     ); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -831,6 +831,23 @@ sub genSSHNodeHostKey | ||||
|     } | ||||
| } | ||||
|  | ||||
| # on Ubuntu need to painstakingly compare /etc/localtime with files under | ||||
| # /usr/share/zoneinfo since /etc/localtime # isn't always a symbolic link | ||||
| sub discover_timezone_ubuntu | ||||
| { | ||||
| 	my $localtime = "/etc/localtime"; | ||||
| 	my $zoneinfo = "/usr/share/zoneinfo"; | ||||
|  | ||||
| 	my $zone_result = `find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV`; | ||||
|  | ||||
| 	my @zones = split /\n/, $zone_result; | ||||
|  | ||||
| 	$zones[0] =~ s/$zoneinfo\///; | ||||
| 	$zones[0] =~ s/\//_/g; | ||||
|  | ||||
| 	return $zones[0]; | ||||
| } | ||||
|  | ||||
| #----------------------------------------------------------------------------- | ||||
|  | ||||
| =head3    initDB  | ||||
| @@ -926,6 +943,10 @@ sub initDB | ||||
|             $tz = | ||||
|               `grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`; | ||||
|         } | ||||
|         elsif (-f "/etc/lsb-release") | ||||
|         { | ||||
|             $tz = discover_timezone_ubuntu; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|  | ||||
|   | ||||
| @@ -1,10 +1,11 @@ | ||||
|  | ||||
| ### Localization | ||||
| d-i debian-installer/locale string en_GB | ||||
| d-i debian-installer/locale string en_US | ||||
| d-i localechooser/supported-locales multiselect en_US.UTF-8 | ||||
|  | ||||
| # Keyboard Selection | ||||
| d-i console-setup/ask_detect boolean false | ||||
| d-i console-setup/layoutcode string uk | ||||
| d-i console-setup/layoutcode string en | ||||
|  | ||||
| ### Network Configuration | ||||
| d-i netcfg/choose_interface select #TABLE:noderes:$NODE:primarynic# | ||||
| @@ -26,7 +27,7 @@ d-i mirror/http/proxy string | ||||
| #d-i mirror/suite string testing | ||||
| # Suite to use for loading installer components (optional). | ||||
| #d-i mirror/udeb/suite string testing | ||||
| #d-i mirror/suite string feisty | ||||
| d-i mirror/suite string maverick | ||||
|   | ||||
|  | ||||
| ### Partitioning | ||||
| @@ -97,7 +98,7 @@ tasksel tasksel/first multiselect standard | ||||
| # gawk required for the xCAT scripts to work | ||||
| # Otherwise it installs mawk, which doesn't work | ||||
|  | ||||
| d-i pkgsel/include string openssh-server ntp gawk | ||||
| d-i pkgsel/include string openssh-server ntp gawk #INCLUDE_DEFAULT_PKGLIST_PRESEED# | ||||
|  | ||||
| d-i debian-installer/allow_unauthenticated string true | ||||
| d-i pkgsel/update-policy select none | ||||
| @@ -123,5 +124,9 @@ d-i preseed/early_command string wget http://#TABLE:noderes:$NODE:nfsserver#/ins | ||||
| d-i preseed/late_command string wget http://#TABLE:noderes:$NODE:nfsserver#/install/autoinst/#TABLE:nodelist:THISNODE:node#.post; \ | ||||
|      chmod u+x #TABLE:nodelist:THISNODE:node#.post; \ | ||||
|      cp ./#TABLE:nodelist:THISNODE:node#.post /target/root/post.script; \ | ||||
|      mount -o bind /proc /target/proc -t proc; \ | ||||
|      mount -o bind /dev /target/dev; \ | ||||
|      mount -o bind /dev/pts /target/dev/pts -t devpts; \ | ||||
|      mount -o bind /sys /target/sys; \ | ||||
|      chroot /target /root/post.script | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user