]> git.ozlabs.org Git - ppp.git/blob - netbsd-1.1/kinstall.sh
support old draft rfc deflate number
[ppp.git] / netbsd-1.1 / 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        11-Dec-95
7
8 ARCH=$(uname -m)
9 CONF=$(uname -v | sed 's/.*(\(.*\)).*/\1/')
10 SYS=/sys
11 ARCHDIR=$SYS/arch/$ARCH
12 CFILE=$ARCHDIR/conf/$CONF
13 SRC=netbsd-1.1
14 DOCONF=
15 DOMAKE=
16
17 # Work out whether to use config or config.old
18 if grep -q '^[  ]*timezone' $CFILE; then
19   CONFIG=config.old
20 else
21   CONFIG=config
22 fi
23
24 # Copy new versions of files into /sys/net
25
26 for f in net/if_ppp.h net/ppp-comp.h net/ppp_defs.h $SRC/bsd-comp.c \
27          $SRC/ppp-deflate.c $SRC/if_ppp.c $SRC/if_pppvar.h $SRC/ppp_tty.c \
28          $SRC/slcompress.c $SRC/slcompress.h common/zlib.c common/zlib.h; do
29   dest=$SYS/net/$(basename $f)
30   if [ -f $dest ]; then
31     if ! diff -qBI '[   ]\$[IN][de].*:.*\$' $f $dest >/dev/null; 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 OLDFILES=files.oldconf
45 NEWFILES=files
46 OLDCONFIG=config.old
47 NEWCONFIG=config
48
49 if [ -f $SYS/conf/$OLDFILES ]; then
50   if ! grep -q ppp-deflate $SYS/conf/$OLDFILES; then
51     echo "Patching $SYS/conf/$OLDFILES"
52     patch -N $SYS/conf/$OLDFILES <$SRC/files.oldconf.patch
53     if [ $CONFIG = $OLDCONFIG ]; then
54       DOCONF=yes
55     fi
56   fi
57 fi
58 if [ -f $SYS/conf/$NEWFILES ]; then
59   if ! grep -q ppp-deflate $SYS/conf/$NEWFILES; then
60     echo "Patching $SYS/conf/$NEWFILES"
61     patch -N $SYS/conf/$NEWFILES <$SRC/files.patch
62     if [ $CONFIG = $NEWCONFIG ]; then
63       DOCONF=yes
64     fi
65   fi
66 fi
67
68 # Tell the user to add a pseudo-device line to the configuration file
69 # and remake the kernel, if necessary.
70
71 if [ -f $CFILE ]; then
72   if ! grep -q '^[      ]*pseudo-device[        ][      ]*ppp' $CFILE; then
73     echo
74     echo "The currently-running kernel was built from configuration file"
75     echo "$CFILE, which does not include PPP."
76     echo "You need either to add a line like 'pseudo-device ppp 2' to"
77     echo "this file, or use another configuration file which includes"
78     echo "a line like this."
79     DOCONF=yes
80   fi
81 fi
82
83 if [ $DOCONF ]; then
84   echo
85   echo "You need to configure and build a new kernel."
86   echo "The procedure for doing this involves the following commands:"
87   echo "(\"$CONF\" may be replaced by the name of another config file.)"
88   echo
89   echo "        cd $ARCHDIR/conf"
90   echo "        /usr/sbin/$CONFIG $CONF"
91   echo "        cd ../compile/$CONF"
92   echo "        make depend"
93   DOMAKE=yes
94 elif [ $DOMAKE ]; then
95   echo
96   echo "You need to build a new kernel."
97   echo "The procedure for doing this involves the following commands:"
98   echo
99   echo "        cd $ARCHDIR/compile/$CONF"
100 fi
101 if [ $DOMAKE ]; then
102   echo "        make"
103   echo
104   echo "Then copy the new kernel ($ARCHDIR/compile/$CONF/netbsd)"
105   echo "to /netbsd and reboot.  (Keep a copy of the old /netbsd,"
106   echo "just in case.)"
107 fi