patch-kernel hack for bzip2 files

Chris Wedgwood (chris@f00f.org)
Mon, 15 Dec 1997 14:09:08 +1300


This small (ugly) hack allows you to use the patch-kernel script with the
`new' bzip2 files hpa is now producing...

-Chris

--- linux/scripts/patch-kernel Wed Mar 27 07:22:14 1996
+++ /usr/src/linux/scripts/patch-kernel Mon Dec 15 14:05:23 1997
@@ -11,6 +11,9 @@
# successful. If it is, then all of the "*.orig" files are removed.
#
# Nick Holloway <Nick.Holloway@alfie.demon.co.uk>, 2nd January 1995.
+#
+# Small hack Chris Wedgwood <chris@cybernrt.co.nz> for bzip2 files. (It
+# really is a hack.. I'll clean it up when I have time).

# Set directories from arguments, or use defaults.
sourcedir=${1-/usr/src/linux}
@@ -29,14 +32,26 @@
while :
do
SUBLEVEL=`expr $SUBLEVEL + 1`
- patch=patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gz
+
+ if [ -e $patchdir/patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.bz2 ] ; then
+ patch=patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.bz2
+ decomprog=bunzip2
+ else if
+ [ -e $patchdir/patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gz ] ; then
+ patch=patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gz
+ decomprog=gunzip
+ else
+ break
+ fi
+ fi
+
if [ ! -r $patchdir/$patch ]
then
break
fi

echo -n "Applying $patch... "
- if gunzip -dc $patchdir/$patch | patch -p1 -s -N -E -d $sourcedir
+ if $decomprog -dc $patchdir/$patch | patch -p1 -s -N -E -d $sourcedir
then
echo "done."
else