updated 'patch-kernel' script.

ADAM Sulmicki (adam@cfar.umd.edu)
Sun, 11 Jan 1998 16:07:02 -0500 (EST)


Hi Linus,

Here is a patch for 2.1.x kernels. It allows to use the
bzip2'ed patches in which new kernels comes out. For some reasons
it did not make into 2.1.7{7,8} so I'm sending it again.

I'm not sure why it did not make into the kernels since I received
positive feedback about it.

Also this time it also has a small fix for handling unzip.

=====================================================================
=====================================================================
diff -ubwi linux/scripts/patch-kernel{.old,} > patch.p-k
=====================================================================
--- linux/scripts/patch-kernel.old Sun Dec 28 19:42:39 1997
+++ linux/scripts/patch-kernel Sun Dec 28 19:50:55 1997
@@ -11,6 +11,7 @@
# successful. If it is, then all of the "*.orig" files are removed.
#
# Nick Holloway <Nick.Holloway@alfie.demon.co.uk>, 2nd January 1995.
+# Adam Sulmicki <adam@cfar.umd.edu>, 28th December 1997.

# Set directories from arguments, or use defaults.
sourcedir=${1-/usr/src/linux}
@@ -29,14 +30,33 @@
while :
do
SUBLEVEL=`expr $SUBLEVEL + 1`
- patch=patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gz
- if [ ! -r $patchdir/$patch ]
- then
+ patch=patch-$VERSION.$PATCHLEVEL.$SUBLEVEL
+ if [ -r $patchdir/${patch}.gz ]; then
+ ext=".gz"
+ name="gzip"
+ uncomp="gunzip -dc"
+ elif [ -r $patchdir/${patch}.bz ]; then
+ ext=".bz"
+ name="bzip"
+ uncomp="bunzip -dc"
+ elif [ -r $patchdir/${patch}.bz2 ]; then
+ ext=".bz2"
+ name="bzip2"
+ uncomp="bunzip2 -dc"
+ elif [ -r $patchdir/${patch}.zip ]; then
+ ext=".zip"
+ name="zip"
+ uncomp="unzip -p"
+ elif [ -r $patchdir/${patch} ]; then
+ ext=""
+ name="plaintext"
+ uncomp="cat"
+ else
break
fi

- echo -n "Applying $patch... "
- if gunzip -dc $patchdir/$patch | patch -p1 -s -N -E -d $sourcedir
+ echo -n "Applying ${patch} (${name})... "
+ if $uncomp ${patchdir}/${patch}${ext} | patch -p1 -s -N -E -d $sourcedir
then
echo "done."
else
=====================================================================