]> git.ozlabs.org Git - ppp.git/blob - freebsd-2.0/kinstall.sh
MP-related code should be wrapped within HAVE_MULTILINK pre-processor
[ppp.git] / freebsd-2.0 / kinstall.sh
1 #!/bin/sh
2
3 # This script modifies the kernel sources in /sys to install
4 # ppp-2.3.  It is intended to be run in the ppp-2.3 directory.
5 #
6 # Paul Mackerras        17-Mar-95
7 #
8 # Modified to match the output of the uname command for FreeBSD 2.1.0
9 # and 2.1.5 (and perhaps later).
10 #
11 # John Lind (john@starfire.mn.org) 18-Nov-96
12
13 KPATH=$(uname -v | sed 's/.*://')
14 CONF=$(echo $KPATH | sed 's;.*compile/;;')
15 SYS=$(echo $KPATH | sed 's;/compile/.*$;;')
16 ARCHDIR=$SYS/i386
17 CFILE=$ARCHDIR/conf/$CONF
18 SRC=freebsd-2.0
19 DOCONF=
20 DOMAKE=
21 CONFIG=config
22
23 # Copy new versions of files into /sys/net
24
25 for f in include/net/if_ppp.h include/net/ppp-comp.h \
26          $SRC/ppp_defs.h $SRC/bsd-comp.c $SRC/ppp-deflate.c \
27          $SRC/if_ppp.c $SRC/if_pppvar.h $SRC/ppp_tty.c \
28          $SRC/pppcompress.c $SRC/pppcompress.h common/zlib.c common/zlib.h; do
29   dest=$SYS/net/$(basename $f)
30   if [ -f $dest ]; then
31     if ! cmp -s $f $dest; then
32       echo "Copying $f to $dest"
33       mv -f $dest $dest.orig && echo " (old version saved in $dest.orig)"
34       cp $f $dest
35       DOMAKE=yes
36     fi
37   else
38     echo "Copying $f to $dest"
39     cp $f $dest
40     DOMAKE=yes
41   fi
42 done
43
44 # Add extra stuff to /sys/conf/files
45
46 if [ -f $SYS/conf/files ]; then
47   if ! grep -q ppp_tty $SYS/conf/files; then
48     echo "Patching $SYS/conf/files"
49     patch -p -N -d $SYS/conf <$SRC/files.patch
50     DOCONF=yes
51   elif ! grep -q ppp-deflate $SYS/conf/files; then
52     echo "Patching $SYS/conf/files"
53     patch -N $SYS/conf/$OLDFILES <$SRC/files-2.2.patch
54     DOCONF=yes
55   fi
56 fi
57
58 # Tell the user to add a pseudo-device line to the configuration file.
59
60 if [ -f $CFILE ]; then
61   if ! grep -q '^[      ]*pseudo-device[        ][      ]*ppp' $CFILE; then
62     echo
63     echo "The currently-running kernel was built from configuration file"
64     echo "$CFILE, which does not include PPP."
65     echo "You need either to add a line like 'pseudo-device ppp 2' to"
66     echo "this file, or use another configuration file which includes"
67     echo "a line like this."
68     DOCONF=yes
69   fi
70 fi
71
72 if [ $DOCONF ]; then
73   echo
74   echo "You need to configure and build a new kernel."
75   echo "The procedure for doing this involves the following commands."
76   echo "(\"$CONF\" may be replaced by the name of another config file.)"
77   echo
78   echo "        cd $ARCHDIR/conf"
79   echo "        /usr/sbin/$CONFIG $CONF"
80   echo "        cd ../../compile/$CONF"
81   echo "        make depend"
82   DOMAKE=yes
83 elif [ $DOMAKE ]; then
84   echo "You need to build a new kernel."
85   echo "The procedure for doing this involves the following commands."
86   echo
87   echo "        cd $KPATH"
88 fi
89 if [ $DOMAKE ]; then
90   echo "        make"
91   echo
92   echo "Then copy the new kernel ($KPATH/kernel) to /"
93   echo "and reboot.  (Keep a copy of the old /kernel, just in case.)"
94 fi