xcat-core/xCAT/postscripts/xcatdsklspost

47 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#####################################################
#
# Generic xCAT post script for diskless nodes
#
#####################################################
if [ ! `uname` == Linux ]; then
MYDIR=`dirname $0`
exec $MYDIR/xcatdsklspost.aix
exit
fi
SIP=`grep dhcp-server-identifier /var/lib/dhclient/dhclient-eth0.leases|tail -n 1|awk '{print $3}'|sed -e 's/;//'`
mkdir -p /etc/stunnel
cat > /etc/stunnel/stunnel.conf << EOF
client=yes
foreground=no
output=/dev/null
verify=0
[xcatd]
accept=400
EOF
echo "connect=$SIP:3001" >> /etc/stunnel/stunnel.conf
stunnel;
sleep 1;
mkdir -p /xcatpost;
mkdir /tmp/postage
cd /tmp/postage
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$SIP/install/postscripts 2> /tmp/wget.log
mv $SIP/install/postscripts/* /xcatpost;
rm -rf $SIP
cd /xcatpost;
PATH=/xcatpost:$PATH
export PATH
chmod +x /xcatpost/*;
/xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript;
chmod +x /tmp/mypostscript
if [ -x /tmp/mypostscript ];then
/tmp/mypostscript
fi
rm -f /tmp/mypostscript
killall stunnel
rm -rf /etc/stunnel