2013-01-18 17:26:23 +00:00
|
|
|
# Build the xCAT-genesis-base rpm on a host system.
|
|
|
|
# Option 1: install the xCAT-genesis-builder rpm (that includes this file) on a system installed with
|
|
|
|
# the distro you want to use to build xCAT-genesis-base.
|
|
|
|
# Option 2: untar the root file system of the distro you want to use and then chroot into it and copy
|
|
|
|
# this whole dir into it somewhere (like /tmp).
|
|
|
|
# Then run this script. The optional 1st arg should be mcp if you are building against mcp.
|
|
|
|
HOSTOS="$1"
|
2012-12-04 18:57:37 +00:00
|
|
|
DIR=`dirname $0`
|
2013-02-05 21:03:12 +00:00
|
|
|
#DIR=`realpath $DIR`
|
|
|
|
DIR=`readlink -f $DIR`
|
2013-01-18 17:26:23 +00:00
|
|
|
|
|
|
|
# get the input files for dracut in the right place
|
|
|
|
DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat
|
|
|
|
mkdir -p $DRACUTMODDIR
|
|
|
|
cp $DIR/* $DRACUTMODDIR
|
|
|
|
if [ "$HOSTOS" = "mcp" ]; then
|
2013-02-18 22:46:22 +00:00
|
|
|
sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install
|
|
|
|
sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install
|
2013-02-05 21:03:12 +00:00
|
|
|
sed -i 's/btrfs//' $DRACUTMODDIR/installkernel
|
|
|
|
#mv -f $DRACUTMODDIR/install.$HOSTOS $DRACUTMODDIR/install
|
|
|
|
#mv -f $DRACUTMODDIR/installkernel.$HOSTOS $DRACUTMODDIR/installkernel
|
2013-01-18 17:26:23 +00:00
|
|
|
fi
|
2012-12-04 18:57:37 +00:00
|
|
|
mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs
|
2013-01-18 17:26:23 +00:00
|
|
|
|
|
|
|
# run dracut
|
2013-01-28 19:06:56 +00:00
|
|
|
if [ "$HOSTOS" = "mcp" ]; then
|
2013-02-05 21:03:12 +00:00
|
|
|
KPATH=`/bin/ls -d /lib/modules/*.x86_64`
|
2013-01-28 19:06:56 +00:00
|
|
|
KERNELVERSION=`basename $KPATH`
|
|
|
|
echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut and kernel $KERNELVERSION ...
|
|
|
|
else
|
|
|
|
echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut ...
|
|
|
|
fi
|
|
|
|
dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
|
2013-01-18 17:26:23 +00:00
|
|
|
|
|
|
|
echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs ...
|
2012-12-04 18:57:37 +00:00
|
|
|
cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs
|
|
|
|
zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi
|
2013-01-18 17:26:23 +00:00
|
|
|
|
|
|
|
# add the kernel
|
|
|
|
if [ "$HOSTOS" = "mcp" ]; then
|
|
|
|
echo Adding kernel /boot/vmlinuz-* ...
|
2013-02-05 21:03:12 +00:00
|
|
|
cp /boot/vmlinuz-*.x86_64 /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel
|
2013-01-18 17:26:23 +00:00
|
|
|
else
|
|
|
|
echo Adding kernel /boot/vmlinuz-`uname -r` ...
|
|
|
|
cp /boot/vmlinuz-`uname -r` /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel
|
|
|
|
fi
|
2012-12-04 18:57:37 +00:00
|
|
|
cd -
|
2013-01-18 17:26:23 +00:00
|
|
|
|
|
|
|
# create tar file
|
|
|
|
echo Tarring /tmp/xcatgenesis.$$/opt into ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 ...
|
2012-12-04 18:57:37 +00:00
|
|
|
cd /tmp/xcatgenesis.$$
|
2012-12-06 14:42:05 +00:00
|
|
|
tar jcf ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 opt
|
2013-01-18 17:26:23 +00:00
|
|
|
|
|
|
|
# build the rpm
|
|
|
|
echo Building xCAT-genesis-base rpm from ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 and $DIR/xCAT-genesis-base.spec ...
|
2012-12-06 14:42:05 +00:00
|
|
|
rpmbuild -ba $DIR/xCAT-genesis-base.spec
|
2013-01-18 17:26:23 +00:00
|
|
|
rm -rf $DRACUTMODDIR
|