Squish a few more char vs unsigned char warnings
[mpls-ppp.git] / linux / mppe / mppeinstall.sh
blob52ae7d12e31661711567ccd82a0cc1263ba7b8e2
1 #!/bin/sh
3 # A quickie script to install MPPE into the 2.2.19+ or 2.4.18+ kernel.
4 # Does very little error checking!!!
7 mppe_files="sha1.[ch] arcfour.[ch] ppp_mppe_compress.c"
9 if [ -z "$1" -o ! -d "$1" ]; then
10 echo "Usage: $0 <linux-source-dir>" >&2
11 exit 1
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
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
43 elif expr $ver : 2.6 >/dev/null ; then
44 patchfiles=`echo $patchdir/linux-2.6*.patch`
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
52 pushd "$1" >/dev/null
53 for patch in $patchfiles; do
54 patch -p1 < $patch
55 done
57 for file in $mppe_files; do
58 cp -v $patchdir/$file drivers/net
59 done
61 popd >/dev/null
63 exit 0