diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 171415e7b..3339b2cec 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1353,6 +1353,7 @@ sub mksysclone copy("$installroot/postscripts/configefi","$pspath/15all.configefi"); copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork"); copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost"); + copy("$installroot/postscripts/makeinitrd","$pspath/20all.makeinitrd"); copy("$installroot/postscripts/killsyslog","$pspath/99all.killsyslog"); unless (-r "$pspath/10all.fix_swap_uuids") @@ -1512,12 +1513,41 @@ sub mksysclone } my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile}; - my $out = xCAT::Utils->runcmd($cmd, -1); + my $rc = xCAT::Utils->runcmd($cmd, -1); - unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost") + my $imagedir; + my $osimagetab = xCAT::Table->new('linuximage'); + my $osimageentry = $osimagetab->getAttribs({imagename => $imagename}, 'rootimgdir'); + if($osimageentry){ + $imagedir = $osimageentry->{rootimgdir}; + $imagedir =~ s/^(\/.*)\/.+\/?$/$1/; + }else{ + $imagedir = "$installroot/sysclone/images"; + $cmd = "chdef -t osimage $imagename rootimgdir=$imagedir/$imagename"; + $rc = `$cmd`; + } + + my $cfgimagedir = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`; + chomp($cfgimagedir); + $cfgimagedir =~ s/^\s+path=(\/.*)\/.+$/$1/g; + + if($imagedir ne $cfgimagedir){ + my $oldstr = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`; + chomp($oldstr); + $oldstr =~ s/\//\\\\\//g; + + my $targetstr="\tpath=".$imagedir."/".$imagename; + $targetstr =~ s/\//\\\\\//g; + $cmd= "sed -i \"s/$oldstr/$targetstr/\" /etc/systemimager/rsync_stubs/40$imagename"; + $rc = `$cmd`; + } + + $rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`; + + unless (-r "$imagedir/$imagename/opt/xcat/xcatdsklspost") { - mkpath("$installroot/sysclone/images/$imagename/opt/xcat/"); - copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/"); + mkpath("$imagedir/$imagename/opt/xcat/"); + copy("$installroot/postscripts/xcatdsklspost","$imagedir/$imagename/opt/xcat/"); } }