From c92210b1ef69d3dcd0ded914fd95b4a7d93a727c Mon Sep 17 00:00:00 2001 From: mxi1 Date: Fri, 16 Apr 2010 01:40:33 +0000 Subject: [PATCH] -the defect 2987733 is fixed; if the entry with one name ended with "/", "-l" should be used to detect whether it is a link or not git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5784 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/statelite.pm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index 41eca0eb5..8996a8fb1 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -229,13 +229,31 @@ sub process_request { 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) { + if (-l $target) { #not one directory 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); + if( -e $default) { + xCAT::Utils->runcmd("cp -a $default $target", 0, 1); + }else { # maybe someone deletes the copy in .default directory + xCAT::Utils->runcmd("touch $target", 0, 1); + } + } + } else { + chop $target; + if( -l $target ) { + my $location = readlink $target; + if ($location =~ /\.statelite\/tmpfs/) { + xCAT::Utils->runcmd("rm -rf $target", 0, 1); + my $default = $rootimg_dir . "/.default" . $f; + if( -e $default) { + xCAT::Utils->runcmd("cp -a $default $target", 0, 1); + } else { + xCAT::Utils->runcmd("mkdir $target", 0, 1); + } + } } }