lkml.org 
[lkml]   [1996]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: patch(1)ing (was Re: Problem with 2.0.20)
On Sun, 15 Sep 1996, Adam D. Bradley wrote:

> BTW, are we both missing something here? Is there a command-line opt (or
> another version) of patch that creates new files in the right places?

What I always do is just go into the directory I'm patching and use `patch
-p1`. That way it doesn't care at all what the directory prefix is for
either the original or patched trees. Works all the time (unless whoever
made the patch used some weird method to create the patch...)

For instance, my script to extract a guaranteed clean version of the
latest kernel tree from my archive of linux-2.0.tar.gz and patch-2.0.*.gz:

-----------
#!/bin/sh
echo -n Cleaning...
rm -rf `/bin/ls -l linux | awk '{print $11}'` linux
echo
echo -n Extracting...
tar -xzf linux-2.0.tar.gz
echo
cd linux
echo -n Patching
for n in ../patch-2.0.?.gz ../patch-2.0.??.gz;do
LATEST=`echo $n | sed 's/\.\.\/patch-\(2\.0\.[0-9]*\)\.gz/\1/'`
zcat $n | patch -p1 -s
echo -n .
done
echo
echo -n Wiping .orig files...
find . -name '*.orig' -exec rm {} \;
echo
cd ..
echo Latest version is $LATEST
mv linux linux-$LATEST
ln -s linux-$LATEST linux
----------
Note that this does no error checking. This is because all the linux
patches are perfect (know a guy who patched all they way from 1.3.1[0-9]
to somewhere in pre-2.0 without a problem) ;-)

TTYL,
Omega

__
__ Erik Walthinsen - Programmer, webmaster, 3D artist, etc. / /\
/ \ / / \
| | M E G A omega@sequent.com Work: (503)578-5314 / / /\ \
_\ /_ omega@teleport.com Home: (503)281-4281 / / /\ \ \
/ /_/__\ \ \
SSA: http://www.teleport.com/~omega/sequent/ (for now) /________\ \ \
\___________\/




\
 
 \ /
  Last update: 2005-03-22 13:38    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site