2008-05-01 20:52:16 +00:00
|
|
|
#!/bin/sh
|
2008-04-14 12:20:34 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#####################################################
|
|
|
|
#
|
|
|
|
# Generic xCAT post script for diskless nodes
|
|
|
|
#
|
|
|
|
#####################################################
|
|
|
|
|
2008-05-01 20:52:16 +00:00
|
|
|
if [ ! `uname` == Linux ]; then
|
|
|
|
MYDIR=`dirname $0`
|
|
|
|
exec $MYDIR/xcatdsklspost.aix
|
|
|
|
exit
|
|
|
|
fi
|
2008-05-13 23:33:16 +00:00
|
|
|
let SLI=$RANDOM%10
|
|
|
|
sleep $SLI
|
2008-05-01 20:52:16 +00:00
|
|
|
|
2008-05-15 21:00:34 +00:00
|
|
|
SIP=`grep -h dhcp-server-identifier /var/lib/dhclient/dhclient-*.leases|tail -n 1|awk '{print $3}'|sed -e 's/;//'`
|
2008-05-09 17:20:04 +00:00
|
|
|
if grep 'rw /rw tmpfs ' /proc/mounts >& /dev/null; then
|
|
|
|
touch /var/lock/subsys/xcatmounts
|
|
|
|
echo '#!/bin/bash' > /etc/rc6.d/K10xcatmounts
|
|
|
|
echo umount -l /ro >> /etc/rc6.d/K10xcatmounts
|
|
|
|
echo umount -l /rw >> /etc/rc6.d/K10xcatmounts
|
|
|
|
chmod 755 /etc/rc6.d/K10xcatmounts
|
|
|
|
ln -sf /etc/rc6.d/K10xcatmounts /etc/rc0.d/K10xcatmounts
|
|
|
|
fi
|
|
|
|
|
2008-05-01 20:52:16 +00:00
|
|
|
|
|
|
|
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
|
2008-05-13 16:58:11 +00:00
|
|
|
#wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$SIP/install/postscripts 2> /tmp/wget.log
|
|
|
|
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$SIP/postscripts 2> /tmp/wget.log
|
|
|
|
#mv $SIP/install/postscripts/* /xcatpost;
|
|
|
|
mv $SIP/postscripts/* /xcatpost;
|
2008-05-01 20:52:16 +00:00
|
|
|
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;
|
2008-05-13 23:33:16 +00:00
|
|
|
MYCONT=`cat /tmp/mypostscript`
|
|
|
|
while [ -z "$MYCONT" ]; do
|
|
|
|
let SLI=$RANDOM%10
|
|
|
|
let SLI=10+$SLI
|
|
|
|
sleep $SLI
|
|
|
|
/xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript;
|
|
|
|
MYCONT=`cat /tmp/mypostscript`
|
|
|
|
done
|
2008-05-01 20:52:16 +00:00
|
|
|
chmod +x /tmp/mypostscript
|
|
|
|
if [ -x /tmp/mypostscript ];then
|
|
|
|
/tmp/mypostscript
|
|
|
|
fi
|
|
|
|
rm -f /tmp/mypostscript
|
|
|
|
killall stunnel
|
|
|
|
rm -rf /etc/stunnel
|