2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 11:42:05 +00:00

Add uuid into /opt/xcat/xcatinfo

This commit is contained in:
Casandra Qiu 2016-06-13 14:40:50 -04:00
parent 993ee53278
commit 3b9eddc6d2
5 changed files with 40 additions and 7 deletions

View File

@ -181,8 +181,12 @@ sub process_request {
system("mkdir -p $rootimg_dir/xcatpost");
system("cp -r $installroot/postscripts/* $rootimg_dir/xcatpost/");
#put the image name and timestamp into diskless image when it is packed.
#put the image name, uuid and timestamp into diskless image when it is packed.
`echo IMAGENAME="'$imagename'" > $rootimg_dir/opt/xcat/xcatinfo`;
my $uuid = `uuidgen`;
chomp $uuid;
`echo IMAGEUUID="'$uuid'" >> $rootimg_dir/opt/xcat/xcatinfo`;
my $timestamp = `date`;
chomp $timestamp;

View File

@ -89,7 +89,12 @@ do
mkdir -p /opt/xcat
touch /opt/xcat/xcatinfo
fi
echo "XCATSERVER=$i" > /opt/xcat/xcatinfo
grep 'XCATSERVER' /opt/xcat/xcatinfo 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/XCATSERVER=.*/XCATSERVER=$i/" /opt/xcat/xcatinfo
else
echo "XCATSERVER=$i" >> /opt/xcat/xcatinfo
fi
break
fi
RAND=$(perl -e 'print int(rand(5)). "\n"')

View File

@ -47,8 +47,21 @@ if [ ! -f /opt/xcat/xcatinfo ]; then
mkdir -p /opt/xcat
touch /opt/xcat/xcatinfo
fi
echo "XCATSERVER=$MASTER_IP" > /opt/xcat/xcatinfo
echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo
grep 'XCATSERVER' /opt/xcat/xcatinfo 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/XCATSERVER=.*/XCATSERVER=$MASTER_IP/" /opt/xcat/xcatinfo
else
echo "XCATSERVER=$MASTER_IP" >> /opt/xcat/xcatinfo
fi
grep 'INSTALLDIR' /opt/xcat/xcatinfo 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/INSTALLDIR=.*/INSTALLDIR=$INSTALLDIR/" /opt/xcat/xcatinfo
else
echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo
fi
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
msgutil_r "$MASTER_IP" "debug" "/opt/xcat/xcatinfo generated" "/var/log/xcat/xcat.log"
fi

View File

@ -322,7 +322,12 @@ if [ "$MODE" = "4" ]; then # for statelite mode
if [ "$KEY" = "XCAT" ]; then
TMP=`echo $i | awk -F= '{print $2}'`
XCATSERVER=`echo $TMP | cut -d: -f1`
echo "XCATSERVER=$XCATSERVER" > /opt/xcat/xcatinfo
grep 'XCATSERVER' /opt/xcat/xcatinfo 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/XCATSERVER=.*/XCATSERVER=$XCATSERVER/" /opt/xcat/xcatinfo
else
echo "XCATSERVER=$XCATSERVER" >> /opt/xcat/xcatinfo
fi
break
fi
done
@ -627,7 +632,7 @@ fi
#save the MASTER into the xcatinfo file for node deployment case,
#for updatenode case, only save it when -M is specified
if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ]; then
new_ms=`grep '^MASTER' /$xcatpost/mypostscript |cut -d= -f2`
new_ms=`grep '^MASTER' /$xcatpost/mypostscript |head -n 1 |cut -d= -f2`
fi
if [ -n "$new_ms" ]; then
if [ ! -f /opt/xcat/xcatinfo ]; then

View File

@ -75,7 +75,13 @@ DHCP_TMP=`sed 's/\(DHCPINTERFACES=\)\(.*\)$/\1"\2"/' /xcatpost/mypostscript.post
echo "$DHCP_TMP" > /xcatpost/mypostscript.post
#mark that the first reboot after installation is finished
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
grep 'REBOOT' /opt/xcat/xcatinfo 2>&1 > /dev/null
if [ $? -eq 0 ]; then
sed -i "s/REBOOT=.*/REBOOT=TRUE/" /opt/xcat/xcatinfo
else
echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo
fi
CNS=`grep NODESTATUS= /xcatpost/mypostscript.post |awk -F = '{print $2}'`
if [ -z "$CNS" ] || [ "$CNS" != "'0'" -a "$CNS" != "'N'" -a "$CNS" != "'n'" ]; then