1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#! /bin/sh
#
# (C) 1998 Manoj Srivastava & Eric Delaunay.
set -e
PATCHNAME=2.2.18-openwall
PATCHFILE=linux-2.2.18-ow1.diff
PATCHDIR=/usr/src/kernel-patches/all
if ! test -d kernel -a -d Documentation ; then
echo "Not in kernel top level directory. Exiting" >&2
exit 1
fi
if test -f debian/APPLIED_all_$PATCHNAME ; then
exit 0 # patch already applied
fi
VERSION=$(grep ^VERSION Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
PATCHLEVEL=$(grep ^PATCHLEVEL Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
SUBLEVEL=$(grep ^SUBLEVEL Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9B]*\)/\1/')
#if [ "$VERSION.$PATCHLEVEL.$SUBLEVEL" != "2.2.10" -a "$VERSION.$PATCHLEVEL.$SUBLEVEL" != "2.2.11" ] ; then
# echo -n "The international kernel patch has only been tested with kernel"
# echo -n "versions 2.2.{10,11,12}. Apply patch (Y/n)?"
# read answer
# if [ "$answer" = "n" -o "$answer" = "N" ] ; then
# exit 1
# fi
#fi
PATCH_VERSION=$(patch -v | head -1 | sed -e 's/[^0-9\.]//g')
PATCH_OPTIONS="-l -s -p1"
rm -f include/asm
# If a prepatch exists apply it:
if test -f $PATCHDIR/pre-openwall-patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gz ; then
zcat $PATCHDIR/pre-openwall-patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gz | patch $PATCH_OPTIONS
fi
cat $PATCHDIR/$PATCHFILE | patch $PATCH_OPTIONS
echo "Removing empty files after patching" >&2
find . -type f -size 0 -exec rm {} \; -print
mkdir -p debian && touch debian/APPLIED_all_$PATCHNAME
exit 0
|