From 9cb3991fece097b1b54a614b78b53d9c5db3d2a2 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 1 Nov 2013 04:09:15 -0700 Subject: [PATCH] fix defect #2980 install kernel-source fail in genimage in rh6/centos --- xCAT-server/share/xcat/netboot/rh/genimage | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index a4c232542..cb35c3cc2 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -70,6 +70,20 @@ sub xdie { die @_; } +#check whether a dir is NFS mounted +sub isNFSdir{ + my $dir=shift; + my $out=qx(df -T -P $dir|tail -n 1|awk '{print \$2}'); + + if($out =~ /nfs/i) + { + return 1; + } + + return 0; +} + + $SIG{INT} = $SIG{TERM} = sub { xdie "Interrupted" }; GetOptions( 'a=s' => \$arch, @@ -236,6 +250,11 @@ unless ($onlyinitrd) { if (!$prompt) { $non_interactive="-y"; } my $yumcmd = "yum $non_interactive -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir/ --disablerepo=* "; + #yum/rpm/zypper has defect on calculating diskspace usage when installing rpm on a NFS mounted installroot + if(isNFSdir("$rootimg_dir")){ + $yumcmd .= "--setopt=diskspacecheck=0 "; + } + foreach (0..$repnum) { $yumcmd .= "--enablerepo=$osver-$arch-$_ "; } @@ -342,9 +361,15 @@ unless ($onlyinitrd) { close($yumconfig); $index--; my $yumcmd_base = "yum $non_interactive -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir/ --disablerepo=* "; + + #yum/rpm/zypper has defect on calculating diskspace usage when installing rpm on a NFS mounted installroot + if(isNFSdir("$rootimg_dir")){ + $yumcmd_base .= "--setopt=diskspacecheck=0 "; + } + foreach (0..$repnum) { $yumcmd_base .= "--enablerepo=$osver-$arch-$_ "; - } + } # for (1..$index) { # $yumcmd .= "--enablerepo=otherpkgs$_ "; # }