]> git.ozlabs.org Git - ppp.git/blob - freebsd-2.0/kinstall.sh
add a few defs
[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 net/if_ppp.h net/ppp-comp.h $SRC/ppp_defs.h $SRC/bsd-comp.c \
26          $SRC/ppp-deflate.c $SRC/if_ppp.c $SRC/if_pppvar.h $SRC/ppp_tty.c \
27          $SRC/pppcompress.c $SRC/pppcompress.h common/zlib.c common/zlib.h; do
28   dest=$SYS/net/$(basename $f)
29   if [ -f $dest ]; then
30     if ! cmp -s $f $dest; then
31       echo "Copying $f to $dest"
32       mv -f $dest $dest.orig && echo " (old version saved in $dest.orig)"
33       cp $f $dest
34       DOMAKE=yes
35     fi
36   else
37     echo "Copying $f to $dest"
38     cp $f $dest
39     DOMAKE=yes
40   fi
41 done
42
43 # Add extra stuff to /sys/conf/files
44
45 if [ -f $SYS/conf/files ]; then
46   if ! grep -q ppp_tty $SYS/conf/files; then
47     echo "Patching $SYS/conf/files"
48     patch -p -N -d $SYS/conf <$SRC/files.patch
49     DOCONF=yes
50   elif ! grep -q ppp-deflate $SYS/conf/files; then
51     echo "Patching $SYS/conf/files"
52     patch -N $SYS/conf/$OLDFILES <$SRC/files-2.2.patch
53     DOCONF=yes
54   fi
55 fi
56
57 # Tell the user to add a pseudo-device line to the configuration file.
58
59 if [ -f $CFILE ]; then
60   if ! grep -q '^[      ]*pseudo-device[        ][      ]*ppp' $CFILE; then
61     echo
62     echo "The currently-running kernel was built from configuration file"
63     echo "$CFILE, which does not include PPP."
64     echo "You need either to add a line like 'pseudo-device ppp 2' to"
65     echo "this file, or use another configuration file which includes"
66     echo "a line like this."
67     DOCONF=yes
68   fi
69 fi
70
71 if [ $DOCONF ]; then
72   echo
73   echo "You need to configure and build a new kernel."
74   echo "The procedure for doing this involves the following commands."
75   echo "(\"$CONF\" may be replaced by the name of another config file.)"
76   echo
77   echo "        cd $ARCHDIR/conf"
78   echo "        /usr/sbin/$CONFIG $CONF"
79   echo "        cd ../../compile/$CONF"
80   echo "        make depend"
81   DOMAKE=yes
82 elif [ $DOMAKE ]; then
83   echo "You need to build a new kernel."
84   echo "The procedure for doing this involves the following commands."
85   echo
86   echo "        cd $KPATH"
87 fi
88 if [ $DOMAKE ]; then
89   echo "        make"
90   echo
91   echo "Then copy the new kernel ($KPATH/kernel) to /"
92   echo "and reboot.  (Keep a copy of the old /kernel, just in case.)"
93 fi