]> git.ozlabs.org Git - ppp.git/blob - netbsd-1.1/kinstall.sh
Previously, 64-bit compilation was dependent upon the version of the OS,
[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 include/net/if_ppp.h include/net/ppp-comp.h include/net/ppp_defs.h \
27          $SRC/bsd-comp.c $SRC/ppp-deflate.c \
28          $SRC/if_ppp.c $SRC/if_pppvar.h $SRC/ppp_tty.c \
29          $SRC/slcompress.c $SRC/slcompress.h common/zlib.c common/zlib.h; do
30   dest=$SYS/net/$(basename $f)
31   if [ -f $dest ]; then
32     if ! diff -qBI '[   ]\$[IN][de].*:.*\$' $f $dest >/dev/null; then
33       echo "Copying $f to $dest"
34       mv -f $dest $dest.orig && echo " (old version saved in $dest.orig)"
35       cp $f $dest
36       DOMAKE=yes
37     fi
38   else
39     echo "Copying $f to $dest"
40     cp $f $dest
41     DOMAKE=yes
42   fi
43 done
44
45 OLDFILES=files.oldconf
46 NEWFILES=files
47 OLDCONFIG=config.old
48 NEWCONFIG=config
49
50 if [ -f $SYS/conf/$OLDFILES ]; then
51   if ! grep -q ppp-deflate $SYS/conf/$OLDFILES; then
52     echo "Patching $SYS/conf/$OLDFILES"
53     patch -N $SYS/conf/$OLDFILES <$SRC/files.oldconf.patch
54     if [ $CONFIG = $OLDCONFIG ]; then
55       DOCONF=yes
56     fi
57   fi
58 fi
59 if [ -f $SYS/conf/$NEWFILES ]; then
60   if ! grep -q ppp-deflate $SYS/conf/$NEWFILES; then
61     echo "Patching $SYS/conf/$NEWFILES"
62     patch -N $SYS/conf/$NEWFILES <$SRC/files.patch
63     if [ $CONFIG = $NEWCONFIG ]; then
64       DOCONF=yes
65     fi
66   fi
67 fi
68
69 # Tell the user to add a pseudo-device line to the configuration file
70 # and remake the kernel, if necessary.
71
72 if [ -f $CFILE ]; then
73   if ! grep -q '^[      ]*pseudo-device[        ][      ]*ppp' $CFILE; then
74     echo
75     echo "The currently-running kernel was built from configuration file"
76     echo "$CFILE, which does not include PPP."
77     echo "You need either to add a line like 'pseudo-device ppp 2' to"
78     echo "this file, or use another configuration file which includes"
79     echo "a line like this."
80     DOCONF=yes
81   fi
82 fi
83
84 if [ $DOCONF ]; then
85   echo
86   echo "You need to configure and build a new kernel."
87   echo "The procedure for doing this involves the following commands:"
88   echo "(\"$CONF\" may be replaced by the name of another config file.)"
89   echo
90   echo "        cd $ARCHDIR/conf"
91   echo "        /usr/sbin/$CONFIG $CONF"
92   echo "        cd ../compile/$CONF"
93   echo "        make depend"
94   DOMAKE=yes
95 elif [ $DOMAKE ]; then
96   echo
97   echo "You need to build a new kernel."
98   echo "The procedure for doing this involves the following commands:"
99   echo
100   echo "        cd $ARCHDIR/compile/$CONF"
101 fi
102 if [ $DOMAKE ]; then
103   echo "        make"
104   echo
105   echo "Then copy the new kernel ($ARCHDIR/compile/$CONF/netbsd)"
106   echo "to /netbsd and reboot.  (Keep a copy of the old /netbsd,"
107   echo "just in case.)"
108 fi