Fixing two problems: 1. introduced while intergrating with buildkit command that only one kitrepo and one kitcomponent in a kit can be added into xCAT. 2. If user renamed the kit tarball filename, addkit canot read kit.conf inside it.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14378 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
cd7d5a50c6
commit
0d3fb931a0
@ -771,31 +771,33 @@ sub addkit
|
||||
} else {
|
||||
# should be a tar.bz2 file
|
||||
|
||||
$basename = basename($kit);
|
||||
# If this kit was built without rpms, user will need to
|
||||
# run buildkit addpkgs to add the rpms to the kit tarfile
|
||||
# before addkit can be run
|
||||
if ( $basename =~ /.NEED_PRODUCT_PKGS.tar.bz2/ ) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "This kit tar file was built without product packages. You will need to separately obtain your product packages, install the xCAT-buildkit rpm, and run the buildkit addpkgs command to add the rpms to the $kit file.";
|
||||
xCAT::MsgUtils->message( "E", \%rsp, $callback );
|
||||
return 1;
|
||||
}
|
||||
$basename =~ s/.tar.bz2//;
|
||||
$kittmpdir = "/tmp/" . $basename;
|
||||
chmod(0666, "$kittmpdir/*");
|
||||
|
||||
system("rm -rf $kittmpdir");
|
||||
|
||||
system("rm -rf /tmp/tmpkit/");
|
||||
mkpath("/tmp/tmpkit/");
|
||||
|
||||
if($::VERBOSE){
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Extract Kit $kit to /tmp";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
$rc = system("tar jxvf $kit -C /tmp");
|
||||
$rc = system("tar jxvf $kit -C /tmp/tmpkit/");
|
||||
} else {
|
||||
$rc = system("tar jxf $kit -C /tmp");
|
||||
$rc = system("tar jxf $kit -C /tmp/tmpkit/");
|
||||
}
|
||||
|
||||
opendir($dir,"/tmp/tmpkit/");
|
||||
my @files = readdir($dir);
|
||||
|
||||
foreach my $file ( @files ) {
|
||||
next if ( $file eq '.' || $file eq '..' );
|
||||
$kittmpdir = "/tmp/tmpkit/$file";
|
||||
last;
|
||||
}
|
||||
|
||||
if ( !$kittmpdir ) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Could not find extracted kit in /tmp/tmpkit";
|
||||
xCAT::MsgUtils->message( "E", \%rsp, $callback );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -843,9 +845,11 @@ sub addkit
|
||||
next;
|
||||
} elsif ($line =~ /kitrepo:/) {
|
||||
$sec = "KITREPO";
|
||||
$kitrepoid = $kitrepoid + 1;
|
||||
next;
|
||||
} elsif ($line =~ /kitcomponent:/) {
|
||||
$sec = "KITCOMPONENT";
|
||||
$kitcompid = $kitcompid + 1;
|
||||
next;
|
||||
} else {
|
||||
($key,$value) = split /=/, $line;
|
||||
|
Loading…
Reference in New Issue
Block a user