xcat-core/xCAT/postscripts/syscloneimgupdate

52 lines
1.6 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#Used only by sysclone
installmethods=`cat /etc/xcat/xcatinstallinfo`
if [ "$installmethods" != "sysclone" ];then
echo "This node didn't be installed by sysclone"
exit 0
fi
#update the exclude configuration file
#do not sync the following files
for filename in /etc/fstab /boot/grub /etc/grub.conf /boot/efi /etc/elilo.conf /xcatpost /etc/xcat /etc/hosts /etc/udev/rules.d /etc/modprobe.d/bond0.conf /etc/modprobe.d/bond1.conf /etc/ssh /etc/sysconfig/syslog /etc/syslog-ng/syslog-ng.conf /opt/xcat /root/.ssh /var/cache /var/lib
do
if [ ! -e $filename ];then
continue
fi
grep -E "^\s*${filename}\s*$" "/etc/systemimager/updateclient.local.exclude"
if [ $? -ne 0 ];then
echo "$filename" >> "/etc/systemimager/updateclient.local.exclude"
fi
done
#get the current image server
str_server_ip=''
. /opt/xcat/xcatinfo
if [ -n "$XCATSERVER" ];then
str_server_ip=$XCATSERVER
else
str_server_ip=$MASTER
fi
if [ -z "$str_server_ip" ];then
echo "Can not find out the image server."
exit 1
fi
str_server_ip=`echo $str_server_ip | sed "s/'//g"`
#call system imager command to update the image
echo "si_updateclient --server $str_server_ip --yes"
export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_updateclient --server $str_server_ip --yes
if [[ -f /sbin/dracut ]]; then
#redhat or centos
echo "Running dracut to regenerate the initrd with the drivers needed by this node:"
dracut --force
else
# suse/sles
echo "Running mkinitrd to regenerate the initrd with the drivers needed by this node:"
mkinitrd
fi