diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 4c0f8e68f..2176550bb 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -173,9 +173,6 @@ sub copycd my $installroot; my $arch; my $path; - my $mntpath=undef; - my $inspection=undef; - $installroot = "/install"; my $sitetab = xCAT::Table->new('site'); if ($sitetab) @@ -192,24 +189,22 @@ sub copycd GetOptions( 'n=s' => \$distname, 'a=s' => \$arch, - 'p=s' => \$path, - 'm=s' => \$mntpath, - 'i' => \$inspection + 'm=s' => \$path, ); - unless ($mntpath) + unless ($path) { #this plugin needs $path... return; } - unless (-r $mntpath . "/.disk/info") + unless (-r $path . "/.disk/info") { xCAT::MsgUtils->message("S","The CD doesn't look like a Debian CD, exiting..."); return; } my $dinfo; - open($dinfo, $mntpath . "/.disk/info"); + open($dinfo, $path . "/.disk/info"); my $line = <$dinfo>; chomp($line); my @line2 = split(/ /,$line); @@ -286,38 +281,13 @@ sub copycd return; } } - - - if($inspection) - { - $callback->( - { - info => - "DISTNAME:$distname\n"."ARCH:$arch\n" - } - ); - return; - } - %{$request} = (); #clear request we've got it. - - my $defaultpath="$installroot/$distname/$arch"; - unless($path) - { - $path=$defaultpath; - } - - $callback->({data => "Copying media to $path"}); - + $callback->( + {data => "Copying media to $installroot/$distname/$arch"}); my $omask = umask 0022; - if(-l $path) - { - unlink($path); - } - mkpath("$path"); - - + mkpath("$installroot/$distname/$arch"); + mkpath("$installroot/$distname/$arch/install/netboot") if ($isnetinst); umask $omask; my $rc; $SIG{INT} = $SIG{TERM} = sub { @@ -330,7 +300,7 @@ sub copycd } }; my $kid; - chdir $mntpath; + chdir $path; my $numFiles = `find . -print | wc -l`; my $child = open($kid,"|-"); unless (defined $child) { @@ -346,7 +316,7 @@ sub copycd close($kid); $rc = $?; } else { - my $c = "nice -n 20 cpio -vdump $path"; + my $c = "nice -n 20 cpio -vdump $installroot/$distname/$arch"; my $k2 = open(PIPE, "$c 2>&1 |") || $callback->({error => "Media copy operation fork failure"}); push @cpiopid, $k2; @@ -364,30 +334,7 @@ sub copycd # system( # "cd $path; find . | nice -n 20 cpio -dump $installroot/$distname/$arch/" # ); - chmod 0755, "$path"; - - unless($path =~ /^($defaultpath)/) - { - mkpath($defaultpath); - if(-d $defaultpath) - { - rmtree($defaultpath); - } - else - { - unlink($defaultpath); - } - - my $hassymlink = eval { symlink("",""); 1 }; - if ($hassymlink) { - symlink($path,$defaultpath); - }else - { - link($path,$defaultpath); - } - - } - + chmod 0755, "$installroot/$distname/$arch"; # Need to do this otherwise there will be warning about corrupt Packages file # when installing a system @@ -403,7 +350,6 @@ sub copycd system("rm -f $installroot/$distname/$arch/dists/unstable"); system("rm -f $installroot/$distname/$arch/dists/testing"); - mkpath("$installroot/$distname/$arch/install/netboot") if ($isnetinst); # copies the netboot files for debian if ($isnetinst) { @@ -418,15 +364,15 @@ sub copycd else { $callback->({data => "Media copy operation successful"}); - my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path); + my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch); if ($ret[0] != 0) { $callback->({data => "Error when updating the osimage tables: " . $ret[1]}); } - my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path); + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot"); if ($ret[0] != 0) { $callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]}); } - my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path); + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite"); if ($ret[0] != 0) { $callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]}); }