]> git.ozlabs.org Git - ppp.git/blob - linux/mppe/mppeinstall.sh
d0a57e55bda66f5cb947323c2f41d418d2cc55ce
[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 very little 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 "$0: 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     typeset -i rel=${ver##*.}
32     if [ $rel -eq 18 ]; then
33         patchfiles="$patchfiles $patchdir/linux-2.4.18-pad.patch"
34     elif [ $rel -gt 18 ]; then
35         patchfiles="$patchfiles $patchdir/linux-2.4.19-pad.patch"
36     else
37         echo "$0: unable to determine kernel version" >&2
38         exit 1
39     fi
40 fi
41
42 echo "Detected kernel version $ver"
43 echo "I will now patch the kernel in directory $1"
44 echo -n "Press ret to continue, CTRL-C to exit: "
45 read
46
47 pushd "$1" >/dev/null
48 for patch in $patchfiles; do
49     patch -p1 < $patch
50 done
51
52 for file in $mppe_files; do
53     cp -v $patchdir/$file drivers/net
54 done
55
56 popd >/dev/null
57
58 exit 0