2014-06-19 08:13:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#Used only by sysclone
|
|
|
|
|
|
|
|
# This SI post-install script is needed because the initrd that autoyast/kickstart/ubuntu builds when installing
|
|
|
|
# sles/rh/ubuntu on the golden node may not have the drivers when that initrd runs on the node that is
|
|
|
|
# being deployed with this image (specifically, drivers to be able to mount the disk).
|
|
|
|
# So rebuild the initrd on the to-node after putting the image on the disk, but before rebooting.
|
|
|
|
|
|
|
|
#todo: Make this script work on red hat by checking for dracut and using that if it exists.
|
|
|
|
# And do whatever is necessary on ubuntu.
|
|
|
|
|
|
|
|
if [[ -f /sbin/dracut ]]; then
|
2014-11-05 02:45:44 +00:00
|
|
|
# redhat6.x/centos6.x/rhels7.x
|
2014-06-19 08:13:26 +00:00
|
|
|
echo "Running dracut to regenerate the initrd with the drivers needed by this node:"
|
2014-11-05 02:45:44 +00:00
|
|
|
arch=`uname -m`
|
|
|
|
#echo "arch=$arch"
|
|
|
|
initrdfile=`find /boot -name "initramfs-*.$arch.img"`
|
|
|
|
#echo "initrdfile=$initrdfile"
|
|
|
|
kernelversion=`echo $initrdfile |sed -e 's:/boot/initramfs-\(.*\)\.img:\1:g'`
|
|
|
|
#echo "kernelversion=$kernelversion"
|
|
|
|
mv $initrdfile $initrdfile.org
|
|
|
|
echo "dracut $initrdfile $kernelversion"
|
|
|
|
dracut $initrdfile $kernelversion
|
2014-06-19 08:13:26 +00:00
|
|
|
else
|
2014-08-20 08:06:33 +00:00
|
|
|
# suse/sles and redhat5.x/centos5.x
|
2014-06-19 08:13:26 +00:00
|
|
|
echo "Running mkinitrd to regenerate the initrd with the drivers needed by this node:"
|
2014-08-20 08:06:33 +00:00
|
|
|
osvers=`cat /etc/*release|sed -e 's/.*\([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/'`
|
|
|
|
if [[ $osvers == 5\.* ]];then
|
|
|
|
initrdfile=`find /boot -name "initrd-*.img"`
|
2014-11-05 02:45:44 +00:00
|
|
|
#echo "initrdfile=$initrdfile"
|
2014-08-20 08:06:33 +00:00
|
|
|
kernelversion=`echo $initrdfile |sed -e 's:/boot/initrd-\(.*\)\.img:\1:g'`
|
2014-11-05 02:45:44 +00:00
|
|
|
#echo "kernelversion=$kernelversion"
|
2014-08-20 08:06:33 +00:00
|
|
|
mv $initrdfile $initrdfile.org
|
2014-11-05 02:45:44 +00:00
|
|
|
echo "mkinitrd $initrdfile $kernelversion"
|
2014-08-20 08:06:33 +00:00
|
|
|
mkinitrd $initrdfile $kernelversion
|
|
|
|
else
|
|
|
|
mkinitrd
|
|
|
|
fi
|
2014-06-19 08:13:26 +00:00
|
|
|
fi
|