File: kdb.apply

package info (click to toggle)
kernel-patch-kdb 0.6-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 308 kB
  • ctags: 12
  • sloc: makefile: 60; sh: 55
file content (46 lines) | stat: -rw-r--r-- 1,203 bytes parent folder | download
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
#! /bin/sh
#
# (C) 1998 Manoj Srivastava & Eric Delaunay.

set -e

ARCHITECTURE=`dpkg --print-installation-architecture`
PATCHNAME=kdb
KVERSION=2.2.13
PATCHFILE=kdb-v0.6-2.2.13.gz
PATCHDIR=/usr/src/kernel-patches/$ARCHITECTURE/kdb

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_${ARCHITECTURE}_$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/')

#PATCH_VERSION=$(patch -v | head -1 | sed -e 's/[^0-9\.]//g')
PATCH_OPTIONS="-l -s -p2"

if [ "$VERSION.$PATCHLEVEL.$SUBLEVEL" != "${KVERSION}" ]
then

    echo Wrong kernel version !
    return 1

fi

rm -f include/asm
zcat $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_${ARCHITECTURE}_$PATCHNAME
exit 0