2013-08-20 09:12:07 +00:00
|
|
|
#!/bin/bash
|
2014-06-19 07:50:46 +00:00
|
|
|
#Used only by sysclone
|
2013-10-17 03:13:44 +00:00
|
|
|
|
|
|
|
if [ ! -f "/opt/xcat/xcatdsklspost" ];then
|
|
|
|
echo "sysclone require /opt/xcat/xcatdsklspost, but it can not be found. return error!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-08-27 03:55:11 +00:00
|
|
|
if [ -f "/opt/xcat/xcatinfo" ];then
|
|
|
|
rm -f "/opt/xcat/xcatinfo"
|
|
|
|
fi
|
2013-08-20 09:12:07 +00:00
|
|
|
|
|
|
|
|
2013-10-17 03:13:44 +00:00
|
|
|
#some modification to the xcatdsklspost, only download scripts
|
|
|
|
line_num=`sed -n -e '/postbootscripts-start-here.*postbootscripts-end-here.*run_ps/=' /opt/xcat/xcatdsklspost | tail -n 1`
|
|
|
|
line_num=`sed -n -e "$line_num,$ {/echo.*TMP.*>.*mypostscript/=}" /opt/xcat/xcatdsklspost | head -n 1`
|
|
|
|
|
|
|
|
sed -n -e "1,${line_num}p" /opt/xcat/xcatdsklspost > /tmp/xcatsysclonepost
|
|
|
|
echo "cd /" >> /tmp/xcatsysclonepost
|
|
|
|
chmod +x /tmp/xcatsysclonepost
|
|
|
|
/tmp/xcatsysclonepost
|
|
|
|
|
2013-10-17 09:20:12 +00:00
|
|
|
if [ -x /usr/bin/openssl ]; then
|
|
|
|
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
|
|
|
|
export USEOPENSSLFORXCAT
|
|
|
|
fi
|
|
|
|
|
|
|
|
. /opt/xcat/xcatinfo
|
|
|
|
XCATSERVER="$XCATSERVER:3001"
|
|
|
|
export XCATSERVER
|
|
|
|
|
2014-06-19 07:50:46 +00:00
|
|
|
if [ ! -d "/etc/xcat/" ];then
|
|
|
|
mkdir -p /etc/xcat
|
|
|
|
fi
|
|
|
|
echo "sysclone" > /etc/xcat/xcatinstallinfo
|
|
|
|
|
2013-10-17 03:13:44 +00:00
|
|
|
cd /xcatpost/
|
|
|
|
#save the postboot scripts to /xcatpost/mypostscript.post
|
|
|
|
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript`
|
|
|
|
echo "$TMP" > /xcatpost/mypostscript.post
|
|
|
|
chmod 755 /xcatpost/mypostscript.post
|
|
|
|
|
|
|
|
#create the post init
|
|
|
|
cp -f /xcatpost/xcatpostinit1 /etc/init.d/xcatpostinit1
|
|
|
|
chmod 755 /etc/init.d/xcatpostinit1
|
|
|
|
ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc3.d/S84xcatpostinit1
|
|
|
|
ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc4.d/S84xcatpostinit1
|
|
|
|
ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc5.d/S84xcatpostinit1
|
|
|
|
|
|
|
|
cp -f /xcatpost/xcatinstallpost /opt/xcat/xcatinstallpost
|
|
|
|
cat >> /opt/xcat/xcatinstallpost << EOF
|
|
|
|
if [ -f /xcatpost/mypostscript.post ]; then
|
|
|
|
RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2`
|
|
|
|
fi
|
|
|
|
if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then
|
|
|
|
chkconfig xcatpostinit1 off
|
2013-08-20 09:12:07 +00:00
|
|
|
fi
|
2013-10-17 03:13:44 +00:00
|
|
|
EOF
|
|
|
|
chmod 755 /opt/xcat/xcatinstallpost
|
2013-08-20 09:12:07 +00:00
|
|
|
|
2013-10-17 03:13:44 +00:00
|
|
|
ls /etc | grep -i suse
|
|
|
|
if [ $? -eq 0 ];then
|
|
|
|
/sbin/insserv -p /etc/init.d xcatpostinit1
|
|
|
|
fi
|
|
|
|
|
|
|
|
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript`
|
|
|
|
echo "$TMP" > /xcatpost/mypostscript
|
|
|
|
|
2013-10-17 09:20:12 +00:00
|
|
|
|
2013-10-17 03:13:44 +00:00
|
|
|
chmod +x /xcatpost/mypostscript
|
|
|
|
/xcatpost/mypostscript
|
|
|
|
|
|
|
|
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript`
|
|
|
|
echo "$TMP" > /tmp/xcatenv
|
|
|
|
. /tmp/xcatenv
|
|
|
|
/xcatpost/addsiteyum
|
|
|
|
|
2014-06-19 07:50:46 +00:00
|
|
|
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
|
|
|
|
/xcatpost/updateflag.awk $MASTER 3002
|
|
|
|
fi
|