busybox awk does not support network socket writing, use nc instead

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16685 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
immarvin 2013-06-19 07:55:54 +00:00
parent 78af39e06f
commit 9ecfc50b91

View File

@ -1337,30 +1337,26 @@ EOF
open($inifile, ">","/tmp/xcatinitrd.$$/tmp/updateflag");
print $inifile <<EOMS;
#!/usr/bin/awk -f
BEGIN {
xcatdhost = ARGV[1]
xcatiport = ARGV[2]
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
print "xCAT_xcatd" |& ns
while(1) {
ns |& getline
if(\$0 == "ready")
print ARGV[3] |& ns
if(\$0 == "done")
break
}
close(ns)
exit 0
}
#!/bin/sh
if [ \$# -eq 3 ]; then
echo \$3 > /tmp/ncarg
nc \$1 \$2 -w 60 -e /tmp/updateflag
else
retrytimes=0
cmd=""
while [ "\$cmd" != "done" ]; do
retrytimes=`expr \$retrytimes + 1`
if [ \$retrytimes -eq 60 ]; then
break;
fi
read -t 60 cmd
if [ "\$cmd" == "ready" ]; then
head -n 1 /tmp/ncarg
rm -rf /tmp/ncarg
fi
done
fi
EOMS
close($inifile);