]> git.ozlabs.org Git - ppp.git/blob - freebsd-3.0/kinstall.sh
Change some Makefile.linux files to use COPTS and CFLAGS the same way
[ppp.git] / freebsd-3.0 / kinstall.sh
1 #!/bin/sh
2
3 # This script modifies the kernel sources in /usr/src/sys to install
4 # ppp-2.3.  It is intended to be run in the ppp-2.3 directory.
5 #
6 # This works for FreeBSD 3.0/3.1
7 # Most of the kernel files are already part of the kernel source
8 # but, this updates them for synchronous HDLC operation
9 #
10 # Paul Fulghum paulkf@microgate.com             August 11, 1999
11 #
12 # 990911 - Added patch for ttycom.h that defines new IOCTL for sync support.
13
14
15 KPATH=$(uname -v | sed 's/.*://')
16 CONF=$(echo $KPATH | sed 's;.*compile/;;')
17 SYS=$(echo $KPATH | sed 's;/compile/.*$;;')
18 ARCHDIR=$SYS/i386
19 CFILE=$ARCHDIR/conf/$CONF
20 SRC=freebsd-3.0
21 DOCONF=
22 DOMAKE=
23 CONFIG=config
24
25 # Patch files in /usr/src/sys/net
26
27 for f in if_ppp.h if_ppp.c ppp_tty.c ; do
28   dest=$SYS/net/$f
29   patch=$SRC/patch.$f
30   if [ -f $dest ]; then
31      echo -n "Patching $dest..."
32      if patch -s -C -N $dest < $patch 2> /dev/null; then
33         patch -s -N $dest < $patch
34         echo "successful."
35         DOMAKE=yes
36      else
37         if patch -s -C -R $dest < $patch 2> /dev/null; then
38            echo "already applied."
39         else
40            echo "failed (incorrect version or already applied)."
41         fi
42      fi
43   else
44     echo "Warning, file $dest not found"
45   fi
46 done
47
48 # Patch files in /usr/src/sys/sys
49
50 for f in ttycom.h ; do
51   dest=$SYS/sys/$f
52   patch=$SRC/patch.$f
53   if [ -f $dest ]; then
54      echo -n "Patching $dest..."
55      if patch -s -C -N $dest < $patch 2> /dev/null; then
56         patch -s -N $dest < $patch
57         echo "successful."
58         DOMAKE=yes
59      else
60         if patch -s -C -R $dest < $patch 2> /dev/null; then
61            echo "already applied."
62         else
63            echo "failed (incorrect version or already applied)."
64         fi
65      fi
66   else
67     echo "Warning, file $dest not found"
68   fi
69 done
70
71 # Patch files in /usr/include/net
72
73 for f in if_ppp.h ; do
74   dest=/usr/include/net/$f
75   patch=$SRC/patch.$f
76   if [ -f $dest ]; then
77      echo -n "Patching $dest..."
78      if patch -s -C -N $dest < $patch 2> /dev/null; then
79         patch -s -N $dest < $patch
80         echo "successful."
81         DOMAKE=yes
82      else
83         if patch -s -C -R $dest < $patch 2> /dev/null; then
84            echo "already applied."
85         else
86            echo "failed (incorrect version or already applied)."
87         fi
88      fi
89   else
90     echo "Warning, file $dest not found"
91   fi
92 done
93
94 # Patch files in /usr/include/sys
95
96 for f in ttycom.h ; do
97   dest=/usr/include/sys/$f
98   patch=$SRC/patch.$f
99   if [ -f $dest ]; then
100      echo -n "Patching $dest..."
101      if patch -s -C -N $dest < $patch 2> /dev/null; then
102         patch -s -N $dest < $patch
103         echo "successful."
104         DOMAKE=yes
105      else
106         if patch -s -C -R $dest < $patch 2> /dev/null; then
107            echo "already applied."
108         else
109            echo "failed (incorrect version or already applied)."
110         fi
111      fi
112   else
113     echo "Warning, file $dest not found"
114   fi
115 done
116
117 # Tell the user to add a pseudo-device line to the configuration file.
118
119 if [ -f $CFILE ]; then
120   if ! grep -q '^[      ]*pseudo-device[        ][      ]*ppp' $CFILE; then
121     echo
122     echo "The currently-running kernel was built from configuration file"
123     echo "$CFILE, which does not include PPP."
124     echo "You need either to add a line like 'pseudo-device ppp 2' to"
125     echo "this file, or use another configuration file which includes"
126     echo "a line like this."
127     DOCONF=yes
128   fi
129 fi
130
131 if [ $DOCONF ]; then
132   echo
133   echo "You need to configure and build a new kernel."
134   echo "The procedure for doing this involves the following commands."
135   echo "(\"$CONF\" may be replaced by the name of another config file.)"
136   echo
137   echo "        cd $ARCHDIR/conf"
138   echo "        /usr/sbin/$CONFIG $CONF"
139   echo "        cd ../../compile/$CONF"
140   echo "        make depend"
141   DOMAKE=yes
142 elif [ $DOMAKE ]; then
143   echo "You need to build a new kernel."
144   echo "The procedure for doing this involves the following commands."
145   echo
146   echo "        cd $KPATH"
147 fi
148 if [ $DOMAKE ]; then
149   echo "        make"
150   echo
151   echo "Then copy the new kernel ($KPATH/kernel) to /"
152   echo "and reboot.  (Keep a copy of the old /kernel, just in case.)"
153 fi