From 688cfffe51c654247ed6c9dd44839a568d490384 Mon Sep 17 00:00:00 2001 From: mxi1 Date: Wed, 31 Mar 2010 12:35:45 +0000 Subject: [PATCH] -defect 2979119 is fixed; git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5626 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/statelite.pm | 25 ++++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index 43ddd550d..41eca0eb5 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -221,35 +221,26 @@ sub process_request { if($entry[1] eq $oldentry[1]) { #$callback->({info => ["$f is not changed..."]}); } else { - # have to consider both genimage and liteimg re-run $callback->({info => ["! $f may be removed or changed..."]}); - #TODO: recover the file back if ($oldentry[1] =~ m/bind/) { # shouldn't copy back from /.default, maybe the user has replaced the file/directory in .postinstall file - my $default = $rootimg_dir."/.default".$f; - #my $target = $rootimg_dir.$f; - #if (-d $target) { - # xCAT::Utils->runcmd("cp -a $default* $target",0, 1); - #}else { - # xCAT::Utils->runcmd("cp -a $default $target",0, 1); - #} + my $default = $rootimg_dir . "/.default" . $f; xCAT::Utils->runcmd("rm -rf $default", 0, 1); # not sure whether it's necessary right now } else { my $target = $rootimg_dir.$f; if (-l $target) { - xCAT::Utils->runcmd("rm -rf $target", 0, 1); + my $location = readlink $target; + # if it is not linked from tmpfs, it should be modified by the .postinstall file + if ($location =~ /\.statelite\/tmpfs/) { + xCAT::Utils->runcmd("rm -rf $target", 0, 1); + my $default = $rootimg_dir . "/.default" . $f; + xCAT::Utils->runcmd("cp -a $default $target", 0, 1); + } } $target = $rootimg_dir . "/.statelite/tmpfs" . $f; xCAT::Utils->runcmd("rm -rf $target", 0, 1); - - my $default = $rootimg_dir . "/.default".$f; - $target = $rootimg_dir . $f; - if ( ! -e $target ) { - xCAT::Utils->runcmd("cp -a $default $target",0, 1); - } - xCAT::Utils->runcmd("rm -rf $default", 0, 1); } } }