Implement multi-driverdisk merge for RHEL6 installs

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11680 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2012-02-25 15:12:12 +00:00
parent 22ed503864
commit 490bd0169f

View File

@ -1489,9 +1489,32 @@ sub insert_dd {
# Create the tmp dir for dd hack
my $dd_dir = mkdtemp("/tmp/ddtmpXXXXXXX");
if (<$install_dir/$os/$arch/Packages/dracut*>) { #new style, skip the fanagling, copy over the dds and append them...
mkpath("$dd_dir/dd");
if (scalar(@dd_list) == 1) { #only one, just append it..
mkpath("$dd_dir/dd");
copy($dd_list[0],"$dd_dir/dd/dd.img");
} elsif (scalar(@dd_list) > 1) {
unless (-x "/usr/bin/createrepo" and -x "/usr/bin/mkisofs") {
my $rsp;
push @{$rsp->{data}}, "Merging multiple driver disks requires createrepo and mkisofs utilities";
xCAT::MsgUtils->message("E", $rsp, $callback);
return undef;
}
mkpath("$dd_dir/newddimg");
mkpath("$dd_dir/tmpddmnt");
foreach my $dd (@dd_list) {
xCAT::Utils->runcmd("mount -o loop $dd $dd_dir/tmpddmnt",-1);
xCAT::Utils->runcmd("cp -a $dd_dir/tmpddmnt/* $dd_dir/newddimg",-1);
xCAT::Utils->runcmd("umount $dd_dir/tmpddmnt",-1);
}
foreach my $repodir (<$dd_dir/newddimg/*/*/repodata>) {
$repodir =~ s/\/repodata\z//;
xCAT::Utils->runcmd("createrepo $repodir",-1);
}
chdir("$dd_dir/newddimg");
xCAT::Utils->runcmd("mkisofs -J -R -o $dd_dir/dd/dd.img .",-1);
} else { #there should be no else...
die "This should never occur";
}
chdir($dd_dir."/dd");
$cmd = "find .|cpio -H newc -o|gzip -9 -c - > ../dd.gz";
xCAT::Utils->runcmd($cmd, -1);
@ -1508,10 +1531,9 @@ sub insert_dd {
local $/ = \32768;
while (my $block = <$ddhdl>) { print $inithdl $block; }
}
chdir("/");
xCAT::Utils->runcmd("rm -rf $dd_dir");
return;
} else {
die "TODO: multiple driver disk combination";
}
}
mkpath "$dd_dir/initrd_img"; # The dir for the new initrd