blob: 4d1f3a35ec2cc523d38d85929e6d974fe6f3cc83 [file] [log] [blame]
#!/bin/bash
#
# This creates an "rpmbuild" environment in which to
# build the CentOS kernel
#
set -x
#
# This is most likely temporary, we need to get the build
# number information into git like the other branches
KNLSUFFIX=$(date "+%y%m%d%H%M%S" )
# We need DST_DIR to be set so that we know where to build
if [ "$DST_DIR" == "" ]
then
echo "DST_DIR is not set"
exit 1
fi
# Save our current directory
SRCDIR=$(pwd)
# Create the target dirs under DST_DIR
mkdir -p $DST_DIR/rpmbuild
mkdir -p $DST_DIR/RPMS
mkdir -p $DST_DIR/SRPMS
# Create an "rpmbuild" environment with symlinks
pushd $DST_DIR/rpmbuild
ln -s ../RPMS .
ln -s ../SRPMS .
cp -rpd $SRCDIR/thirdparty/SOURCES .
cp $SRCDIR/patches/* $DST_DIR/rpmbuild/SOURCES
mkdir SPECS
# Use rpmbuid to build the new kernel
cd SPECS
cp $SRCDIR/thirdparty/SPECS/kernel.spec .
cat $SRCDIR/patches/kernel.spec.patch | sed s/KNLSUFFIX/$KNLSUFFIX/ | patch -p0
export HOME=$DST_DIR
rpmbuild -ba kernel.spec
popd