#!/bin/bash # Find out what version we want base=`wget "http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/" -O - | grep "\[DIR\]" | tail -1 | sed -e 's/\/<\/A>.*//' -e 's/.*>//'` cset=`wget "http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/$base/" -O - | grep "\[DIR\]" | tail -1 | sed -e 's/\/<\/A>.*//' -e 's/.*>//'` csetfilename="$cset.gz" # End early if we already have one if [ -d linux-$base-`echo $cset | sed 's/.txt//'` ] then echo "We already have the latest cset" exit 0 fi # Get the cset if we need it if [ ! -f $cset ] then wget "http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/$base/$cset/$csetfilename" gunzip $csetfilename fi if [ ! -f $cset ] then echo "Failed to get cset" exit 1 fi # Get the kernel base if we need it if [ ! -d linux-$base ] then wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-$base.tar.bz2 tar --bzip2 -xf linux-$base.tar.bz2 fi if [ ! -d linux-$base ] then echo "Failed to get the base" exit 2 fi # Copy to the target directory echo "Copying the base to the new cset directory, and applying the patch" cp -R linux-$base linux-$base-`echo $cset | sed 's/.txt//'` pwd=`pwd` cd linux-$base-`echo $cset | sed 's/.txt//'` patch -p 1 < $pwd/$cset cd $pwd echo linux-$base-`echo $cset | sed 's/.txt//'` > latestmm