]> git.ozlabs.org Git - ppp.git/blob - linux/mppe/mppeinstall.sh
Run ntlm_auth as the user that invoked pppd.
[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- and trailing -release
17 ver=`echo "${1##*/}" | sed -e 's/linux-//' -e 's/-.*//'`
18 if ! expr "$ver" : 2.[246] >/dev/null ; then
19     ver=`echo "${1##*/}" | sed -e 's/kernel-source-//' -e 's/-.*//'`
20     if ! expr "$ver" : 2.[246] >/dev/null ; then
21         echo "$0: Unable to determine kernel version ($ver)" >&2
22         exit 1
23     fi
24 fi
25
26 # build patch files list
27 patchdir=`pwd`
28 patchfiles=
29 if expr $ver : 2.2 >/dev/null ; then
30     patchfiles=$patchdir/linux-2.2.*.patch
31 elif expr $ver : 2.4 >/dev/null ; then
32     patchfiles=`echo $patchdir/linux-2.4.18-{include,make}.patch`
33     # need to differentiate a bit
34     typeset -i rel=${ver##*.}
35     if [ $rel -eq 18 ]; then
36         patchfiles="$patchfiles $patchdir/linux-2.4.18-pad.patch"
37     elif [ $rel -gt 18 ]; then
38         patchfiles="$patchfiles $patchdir/linux-2.4.19-pad.patch"
39     else
40         echo "$0: unable to determine kernel version" >&2
41         exit 1
42     fi
43 elif expr $ver : 2.6 >/dev/null ; then
44     patchfiles=`echo $patchdir/linux-2.6*.patch`
45 fi
46
47 echo "Detected kernel version $ver"
48 echo "I will now patch the kernel in directory $1"
49 echo -n "Press ret to continue, CTRL-C to exit: "
50 read
51
52 pushd "$1" >/dev/null
53 for patch in $patchfiles; do
54     patch -p1 < $patch
55 done
56
57 for file in $mppe_files; do
58     cp -v $patchdir/$file drivers/net
59 done
60
61 popd >/dev/null
62
63 exit 0