Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SRPM_URL='http://mirror.centos.org/centos/5/updates/SRPMS/'
- PATCH_URL='http://www.ssi.bg/~ja/nfct/'
- PATCH_FILE='ipvs-nfct-2.6.16-1.diff'
- BUILD_OPTIONS='--with baseonly --without debug --without debuginfo'
- cd
- rm rpmbuild -rf
- mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- echo '%_topdir %(echo $HOME)/rpmbuild' > .rpmmacros
- mkdir files -p
- cd files
- if [ $# -eq "1" ]; then
- echo "selected kernel -> $1"
- if [ -f $1 ]; then
- echo "kernel source rpm exist"
- else
- echo "fetching kernel source rpm"
- wget $SRPM_URL$1
- fi
- else
- echo "please provide one of the following kerenels as parameter:"
- curl -s $SRPM_URL | grep -i kernel | sed s/"\(.*<a href=\"\)\([^\"]*\)\">\(.*\)"/\\2/g;
- exit 1
- fi
- echo "extracting package"
- rpm -i $1 2>&1 | grep -v mockb
- cd ~/rpmbuild/SOURCES
- echo "downloading NFCT PATCH"
- wget $PATCH_URL$PATCH_FILE
- echo "patching kernel configs"
- for i in `ls kernel-2.6.18-*.config`; do
- total_lines=`cat $i | wc -l`
- line_number=`cat $i | grep -n CONFIG_IP_VS_FTP | grep -o "[0-9]\+"`
- head -n $line_number $i > $i.tmp
- echo "CONFIG_IP_VS_NFCT=y" >> $i.tmp
- tail -n $(($total_lines - $line_number)) $i >> $i.tmp
- mv $i.tmp $i
- done;
- echo "patching kernel spec file"
- PATCH_LOCATION1='# adds rhel version info to version.h'
- PATCH_LOCATION2='# correction of SUBLEVEL/EXTRAVERSION in top-level source tree Makefile'
- cd ~/rpmbuild/SPECS/
- cat kernel-2.6.spec |
- sed -e "s,$PATCH_LOCATION1,Patch40000: ipvs-nfct-2.6.16-1.diff\n$PATCH_LOCATION1,g" |
- sed -e "s,$PATCH_LOCATION2,%patch40000 -p1\n$PATCH_LOCATION2,g" > kernel-2.6.spec.tmp
- mv kernel-2.6.spec.tmp kernel-2.6.spec
- echo "unpacking kernel and applying patches"
- rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err-step1.log | tee prep-out-step1.log
- cp ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.`uname -m`/configs/* ~/rpmbuild/SOURCES
- echo "building kernel rpms"
- rpmbuild -bb $BUILD_OPTIONS --target=`uname -m` kernel-2.6.spec 2> build-err.log | tee build-out.log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement