diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm
index 37010b51f..302cd96a4 100644
--- a/xCAT-server/lib/perl/xCAT/Template.pm
+++ b/xCAT-server/lib/perl/xCAT/Template.pm
@@ -154,167 +154,154 @@ sub subvars {
#do *all* includes, recursive and all
my $doneincludes=0;
while (not $doneincludes) {
- $doneincludes=1;
- if ($inc =~ /#INCLUDE_PKGLIST:[^#^\n]+#/) {
- $doneincludes=0;
- $inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1, 0, 1)/eg;
- }
- if ($inc =~ /#INCLUDE_PTRNLIST:[^#^\n]+#/) {
- $doneincludes=0;
- $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg;
- }
- if ($inc =~ /#INCLUDE_RMPKGLIST:[^#^\n]+#/) {
- $doneincludes=0;
- $inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1, 0, 3)/eg;
- }
- if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
- $doneincludes=0;
- $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
- }
- }
-
- #support multiple paths of osimage in rh/sles diskfull installation
- my @pkgdirs;
- if ( defined($media_dir) ) {
- @pkgdirs = split(",", $media_dir);
- my $source;
- my $source_in_pre;
- my $c = 0;
- foreach my $pkgdir(@pkgdirs) {
- if( $platform =~ /^(rh|SL|centos|fedora)$/ ) {
- if ( $c == 0 ) {
- # After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
- # the rhels5.9 will not be installed successfully. So put in kickstart directly.
- $source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos";
- $source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #For rhels5.9
- } else {
- $source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
- $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
+ #support multiple paths of osimage in rh/sles diskfull installation
+ my @pkgdirs;
+ if ( defined($media_dir) ) {
+ @pkgdirs = split(",", $media_dir);
+ my $source;
+ my $source_in_pre;
+ my $c = 0;
+ foreach my $pkgdir(@pkgdirs) {
+ if( $platform =~ /^(rh|SL|centos|fedora)$/ ) {
+ if ( $c == 0 ) {
+ # After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
+ # the rhels5.9 will not be installed successfully. So put in kickstart directly.
+ $source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos";
+ $source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #For rhels5.9
+ } else {
+ $source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
+ $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
+ }
+ } elsif ($platform =~ /^(sles|suse)/) {
+ my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir";
+ $source .= "
+ $http
+ SuSE-Linux-pkg$c
+ /
+ false
+ SuSE-Linux-pkg$c
+ ";
+ $source_in_pre .="http://'\$nextserver'$pkgdirSuSE-Linux-pkg$c/falseSuSE-Linux-pkg$c";
+ }
+ $c++;
+ }
+
+ $inc =~ s/#INSTALL_SOURCES#/$source/g;
+ $inc =~ s/#INSTALL_SOURCES_IN_PRE#/$source_in_pre/g;
+ }
+
+ #ok, now do everything else..
+ my $shortname = $node;
+ $shortname =~ s/\..*//;
+ $inc =~ s/#TABLE:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3)/eg;
+ $inc =~ s/#TABLEBLANKOKAY:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3,'1')/eg;
+ $inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg;
+ $inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
+ $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
+ $inc =~ s/#MACHINEPASSWORD#/machinepassword()/eg;
+ $inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
+ $inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
+ $inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
+ $inc =~ s/#YAST2NET#/yast2network()/eg;
+ $inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
+ $inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
+ $inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
+ $inc =~ s/#WINNETCFG#/windows_net_cfg()/eg;
+ $inc =~ s/#WINADJOIN#/windows_join_data()/eg;
+ $inc =~ s/#WINPOSTSCRIPTS#/windows_postscripts()/eg;
+ $inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg;
+ $inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg;
+ $inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg;
+ $inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg;
+ $inc =~ s/#HOSTNAME#/$node/g;
+ $inc =~ s/#SHORTNAME#/$shortname/g;
+ $inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg;
+
+ my $nrtab = xCAT::Table->new("noderes");
+ my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']);
+ my $sles_sdk_media = "http://" . $tftpserver->{tftpserver} . $media_dir . "/sdk1";
+
+ $inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
+
+ #if user specify the partion file, replace the default partition strategy
+ if ($partitionfile){
+ #if the content of the partition file is definition replace the default is ok
+ my $partcontent = '';
+ my $scriptflag = 0;
+
+ if ($partitionfile =~ /^s:(.*)/){
+ $scriptflag = 1;
+ $partitionfile = $1;
+ }
+
+ if (-r $partitionfile){
+ open ($inh, "<", $partitionfile);
+ while (<$inh>){
+ $partcontent .= $_;
+ }
+ close ($inh);
+
+ #the content of the specified file is a script which can write partition definition into /tmp/partitionfile
+ if ($scriptflag){
+ #for redhat/sl/centos/kvm/fedora
+ if ($inc =~ /#XCAT_PARTITION_START#/) {
+ my $tempstr = "%include /tmp/partitionfile\n";
+ $inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
+ #modify the content in the file, and write into %pre part
+ #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
+
+ $partcontent .= "chmod 755 /tmp/partscript\n";
+ $partcontent .= "/tmp/partscript\n";
+ #replace the #XCA_PARTITION_SCRIPT#
+ $inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
+ }
+ #for sles/suse
+ elsif ($inc =~ //){
+ my $tempstr = "XCATPARTITIONTEMP";
+ $inc =~ s/[\s\S]*/$tempstr/;
+ #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
+ $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
+ $partcontent .= "chmod 755 /tmp/partscript\n";
+ $partcontent .= "/tmp/partscript\n";
+ $inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
+ }
+ }
+ else{
+ $partcontent =~ s/\s$//;
+ if ($inc =~ /#XCAT_PARTITION_START#/){
+ $inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$partcontent/;
+ }
+ elsif ($inc =~ //){
+ $inc =~ s/[\s\S]*/$partcontent/;
+ }
}
- } elsif ($platform =~ /^(sles|suse)/) {
- my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir";
- $source .= "
- $http
- SuSE-Linux-pkg$c
- /
- false
- SuSE-Linux-pkg$c
- ";
- $source_in_pre .="http://'\$nextserver'$pkgdirSuSE-Linux-pkg$c/falseSuSE-Linux-pkg$c";
}
- $c++;
}
- $inc =~ s/#INSTALL_SOURCES#/$source/g;
- $inc =~ s/#INSTALL_SOURCES_IN_PRE#/$source_in_pre/g;
- }
-
-
-
-
- #Support hierarchical include
- $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
- if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
- $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
- }
-
- #ok, now do everything else..
- my $shortname = $node;
- $shortname =~ s/\..*//;
- $inc =~ s/#TABLE:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3)/eg;
- $inc =~ s/#TABLEBLANKOKAY:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3,'1')/eg;
- $inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg;
- $inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1,0,1)/eg;
- $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1,0,2)/eg;
- $inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1,0,3)/eg;
- $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
- $inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
- $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
- $inc =~ s/#MACHINEPASSWORD#/machinepassword()/eg;
- $inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
- $inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
- $inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
- $inc =~ s/#YAST2NET#/yast2network()/eg;
- $inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
- $inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
- $inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
- $inc =~ s/#WINNETCFG#/windows_net_cfg()/eg;
- $inc =~ s/#WINADJOIN#/windows_join_data()/eg;
- $inc =~ s/#WINPOSTSCRIPTS#/windows_postscripts()/eg;
- $inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg;
- $inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg;
- $inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg;
- $inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg;
- $inc =~ s/#HOSTNAME#/$node/g;
- $inc =~ s/#SHORTNAME#/$shortname/g;
- $inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg;
-
- my $nrtab = xCAT::Table->new("noderes");
- my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']);
- my $sles_sdk_media = "http://" . $tftpserver->{tftpserver} . $media_dir . "/sdk1";
-
- $inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
-
- #if user specify the partion file, replace the default partition strategy
- if ($partitionfile){
- #if the content of the partition file is definition replace the default is ok
- my $partcontent = '';
- my $scriptflag = 0;
-
- if ($partitionfile =~ /^s:(.*)/){
- $scriptflag = 1;
- $partitionfile = $1;
- }
-
- if (-r $partitionfile){
- open ($inh, "<", $partitionfile);
- while (<$inh>){
- $partcontent .= $_;
- }
- close ($inh);
-
- #the content of the specified file is a script which can write partition definition into /tmp/partitionfile
- if ($scriptflag){
- #for redhat/sl/centos/kvm/fedora
- if ($inc =~ /#XCAT_PARTITION_START#/) {
- my $tempstr = "%include /tmp/partitionfile\n";
- $inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
- #modify the content in the file, and write into %pre part
- #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
- $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
-
- $partcontent .= "chmod 755 /tmp/partscript\n";
- $partcontent .= "/tmp/partscript\n";
- #replace the #XCA_PARTITION_SCRIPT#
- $inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
- }
- #for sles/suse
- elsif ($inc =~ //){
- my $tempstr = "XCATPARTITIONTEMP";
- $inc =~ s/[\s\S]*/$tempstr/;
- #$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
- $partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
- $partcontent .= "chmod 755 /tmp/partscript\n";
- $partcontent .= "/tmp/partscript\n";
- $inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
- }
- }
- else{
- $partcontent =~ s/\s$//;
- if ($inc =~ /#XCAT_PARTITION_START#/){
- $inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$partcontent/;
- }
- elsif ($inc =~ //){
- $inc =~ s/[\s\S]*/$partcontent/;
- }
- }
- }
+ $doneincludes=1;
+ if ($inc =~ /#INCLUDE_PKGLIST:[^#^\n]+#/) {
+ $doneincludes=0;
+ $inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1, 0, 1)/eg;
+ }
+ if ($inc =~ /#INCLUDE_PTRNLIST:[^#^\n]+#/) {
+ $doneincludes=0;
+ $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg;
+ }
+ if ($inc =~ /#INCLUDE_RMPKGLIST:[^#^\n]+#/) {
+ $doneincludes=0;
+ $inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1, 0, 3)/eg;
+ }
+ if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
+ $doneincludes=0;
+ $inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
+ }
}
if ($tmplerr) {
- close ($outh);
- return $tmplerr;
- }
+ close ($outh);
+ return $tmplerr;
+ }
print $outh $inc;
close($outh);
return 0;
diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm
index e03144698..a5e2eb60a 100644
--- a/xCAT-server/lib/xcat/plugins/anaconda.pm
+++ b/xCAT-server/lib/xcat/plugins/anaconda.pm
@@ -1989,12 +1989,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);
+
+ 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;
- unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost")
+ 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/");
}
}
diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm
index 00aa51d96..26e58572f 100644
--- a/xCAT-server/lib/xcat/plugins/imgcapture.pm
+++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm
@@ -123,14 +123,14 @@ sub process_request {
# Handle image capture separately for s390x
if ($arch eq 's390x') {
eval { require xCAT_plugin::zvm; }; # Load z/VM plugin dynamically
- xCAT_plugin::zvm->imageCapture($callback, $node, $os, $arch, $type, $profile, $osimg, $device);
+ xCAT_plugin::zvm->imageCapture($callback, $node, $os, $arch, $profile, $osimg, $device);
return;
}
my $shortname = xCAT::InstUtils->myxCATname();
my $rc;
- $rc = sysclone_configserver($shortname, $callback, $doreq);
+ $rc = sysclone_configserver($shortname, $osimg, $callback, $doreq);
if($rc){
my $rsp = {};
$rsp->{data}->[0] = qq{Can not configure Imager Server on $shortname.};
@@ -467,7 +467,7 @@ sub getplatform {
}
sub sysclone_configserver{
- my ($server, $callback, $subreq) = @_;
+ my ($server, $osimage, $callback, $subreq) = @_;
# check if systemimager is installed on the imager server
my $rsp = {};
@@ -514,9 +514,40 @@ sub sysclone_configserver{
{
mkpath($sysclone_overrides);
}
+
+ my $imagedir;
+ my $osimgtab = xCAT::Table->new('osimage');
+ my $entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
+ if(!$entry){
+ $imagedir = $sysclone_home . "/images/" . $osimage;
+ }else{
+ my $osimagetab = xCAT::Table->new('linuximage');
+ my $osimageentry = $osimagetab->getAttribs({imagename => $osimage}, 'rootimgdir');
+ if($osimageentry){
+ $imagedir = $osimageentry->{rootimgdir};
+ if (!(-e $imagedir)){
+ mkpath($imagedir);
+ }
+ }else{
+ $imagedir = $sysclone_home . "/images/" . $osimage;
+ $cmd = "chdef -t osimage $osimage rootimgdir=$imagedir";
+ $rc = `$cmd`;
+ }
+ }
+ $imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
+ $imagedir =~ s/\//\\\\\//g;
+ $imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
+
+ my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
+ $olddir =~ s/\//\\\\\//g;
+ chomp($olddir);
+
+ $cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
+ $rc = `$cmd`;
+
# update /etc/systemimager/rsync_stubs/10header to generate new /etc/systemimager/rsyncd.conf
- my $rc = `sed -i "s/\\/var\\/lib\\/systemimager/\\/install\\/sysclone/g" /etc/systemimager/rsync_stubs/10header`;
+ $rc = `sed -i "s/\\/var\\/lib\\/systemimager/\\/install\\/sysclone/g" /etc/systemimager/rsync_stubs/10header`;
$rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`;
return 0;
@@ -636,20 +667,15 @@ sub sysclone_createosimgdef{
my ($node, $server, $osimage, $callback, $subreq) = @_;
my $createnew = 0;
my %osimgdef;
- my $DBname = xCAT::Utils->get_DBName; # support for DB2
+
my $osimgtab = xCAT::Table->new('osimage');
- my $entry;
- if ($DBname =~ /^DB2/) {
- $entry = ($osimgtab->getAllAttribsWhere("\"imagename\" = '$osimage'", 'ALL' ))[0];
- } else {
- $entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
- }
- if($entry){
+ my $entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
+ if($entry){
my $rsp = {};
$rsp->{data}->[0] = qq{Using the existing osimage "$osimage" defined on $server.};
xCAT::MsgUtils->message("I", $rsp, $callback);
return 0;
- }
+ }
# try to see if we can get the osimage def from golden client.
my $nttab = xCAT::Table->new('nodetype');
@@ -683,6 +709,22 @@ sub sysclone_createosimgdef{
$osimgdef{$osimage}{template} = "";
$osimgdef{$osimage}{otherpkglist} = "";
$osimgdef{$osimage}{pkglist} = "";
+
+ if(!($imagedef{$oldimg}{rootimgdir})){
+ $imagedef{$oldimg}{rootimgdir} = $sysclone_home . "/images/" . $osimage;
+
+ my $imagedir = $imagedef{$oldimg}{rootimgdir};
+ $imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
+ $imagedir =~ s/\//\\\\\//g;
+ $imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
+
+ my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
+ $olddir =~ s/\//\\\\\//g;
+ chomp($olddir);
+
+ my $cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
+ my $rc = `$cmd`;
+ }
}
} else {
$createnew = 1;
@@ -706,6 +748,18 @@ sub sysclone_createosimgdef{
$osimgdef{$osimage}{osname} = "Linux";
$osimgdef{$osimage}{osvers} = $osver;
$osimgdef{$osimage}{osdistroname} = "$osver-$arch";
+
+ $osimgdef{$osimage}{rootimgdir} = $sysclone_home . "/images/" . $osimage;
+ my $imagedir = $osimgdef{$osimage}{rootimgdir};
+ $imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
+ $imagedir =~ s/\//\\\\\//g;
+ $imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
+ my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
+ $olddir =~ s/\//\\\\\//g;
+ chomp($olddir);
+ my $cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
+ my $rc = `$cmd`;
+
#$osimgdef{$osimage}{pkgdir} = "/install/$osver/$arch";
#$osimgdef{$osimage}{otherpkgdir} = "/install/post/otherpkgs/$osver/$arch";
}