2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

make ubuntu as a specific scenario

This commit is contained in:
hu-weihua 2016-05-05 04:06:24 -04:00
parent 60a06d04e8
commit 7238c7391b

View File

@ -22,6 +22,12 @@ my $needshow = 0;
my $restore = 0;
my $ret = 0;
my $string1 = undef;
my $isubuntu=0;
my $output=`cat /etc/lsb-release 2>&1 |grep -i Ubuntu| wc -l`;
chomp($output);
$isubuntu=1 if($output > 0);
if (
!GetOptions("h|?" => \$needhelp,
"f=s" => \$configfile,
@ -882,7 +888,14 @@ sub runcmd
my $rc = 0;
$::RUNCMD_RC = 0;
my $outref = [];
@$outref = `/bin/bash -lic '$cmd 2>&1'`;
if($isubuntu){
$cmd=~s/(")/\\\1/g;
$cmd=~s/(`)/\\\1/g;
@$outref = `/bin/bash -lic "$cmd 2>&1"`;
}else{
@$outref = `$cmd 2>&1`;
}
if ($?)
{
$rc = $? ;