]> git.ozlabs.org Git - ppp.git/blob - linux/mppe/mppeinstall.sh
modify ppp_generic patch to avoid an if() test and extra additions on
[ppp.git] / linux / mppe / mppeinstall.sh
1 #!/bin/sh
2 #
3 # A quickie script to install MPPE into the 2.2.19+ or 2.4.18+ kernel.
4 # Does no error checking!!!
5 #
6
7 mppe_files="sha1.[ch] arcfour.[ch] ppp_mppe_compress.c"
8
9 if [ -z "$1" -o ! -d "$1" ]; then
10     echo "Usage: $0 <linux-source-dir>" >&2
11     exit 1
12 fi
13
14 # strip any trailing /
15 set -- ${1%/}
16 # strip leading /path/to/linux-
17 ver=`echo "${1##*/}" | sed -e 's/linux-//'` # -e 's/\/$//'
18 if ! expr "$ver" : 2.[24] >/dev/null ; then
19     echo "Unable to determine kernel version ($ver)" >&2
20     exit 1
21 fi
22
23 # build patch files list
24 patchdir=`pwd`
25 patchfiles=
26 if expr $ver : 2.2 >/dev/null ; then
27     patchfiles=$patchdir/linux-2.2.*.patch
28 elif expr $ver : 2.4 >/dev/null ; then
29     patchfiles=`echo $patchdir/linux-2.4.18-{include,make}.patch`
30     # need to differentiate a bit
31     rel=${ver##*.}
32     if [ $rel -gt 18 ] ; then
33         patchfiles="$patchfiles $patchdir/linux-2.4.19-pad.patch"
34     else
35         patchfiles="$patchfiles $patchdir/linux-2.4.18-pad.patch"
36     fi
37 fi
38
39 echo "Detected kernel version $ver"
40 echo "I will now patch the kernel in directory $1"
41 echo -n "Press ret to continue, CTRL-C to exit: "
42 read
43
44 pushd "$1" >/dev/null
45 for patch in $patchfiles; do
46     patch -p1 < $patch
47 done
48
49 for file in $mppe_files; do
50     cp -v $patchdir/$file drivers/net
51 done
52
53 popd >/dev/null
54
55 exit 0