blob: b94d2a1dea34eae8605af87247d493d9b21b79fa [file] [log] [blame] [raw]
Darren Reedbd81eb32006-06-15 16:06:55 +00001#! /bin/sh
2#
3# kinstall/minstall - install patches to kernel sources
4#
5# WARNING: This script should be run exactly once on a virgin system
6#
7PATH=/sbin:/usr/sbin:/bin:/usr/bin; export PATH
8
9# try to bomb out fast if anything fails....
10set -e
11
12argv0=`basename $0`
13dir=`pwd`
14karch=`uname -m`
15archdir="/sys/arch/$karch"
16confdir="$archdir/conf"
17
18case "$dir" in
19*/NetBSD )
20 cd ..
21 ;;
22esac
23
24echo "Patching ip_input.c, ip_output.c and in_proto.c ..."
25cat NetBSD/i*.c.diffs | (cd /sys/netinet; patch)
26
27if [ -f /sys/conf/files.newconf ]; then
28 echo "Patching /sys/conf/files.newconf ..."
29 cat NetBSD/files.newconf.diffs | (cd /sys/conf; patch)
30 echo "Patching /sys/conf/files ..."
31 cat NetBSD/files.diffs | (cd /sys/conf; patch)
32fi
33if [ -f /sys/conf/files.oldconf ]; then
34 echo "Patching /sys/conf/files.oldconf ..."
35 cat NetBSD/files.oldconf.diffs | (cd /sys/conf; patch)
36 echo "Patching /sys/conf/files ..."
37 cat NetBSD/filez.diffs | (cd /sys/conf; patch)
38fi
39
40echo -n "Kernel configuration to update [GENERIC] "
41read newconfig junk
42
43if [ -n "$newconfig" ] ; then
44 config="$confdir/$newconfig"
45else
46 newconfig="$confdir/GENERIC"
47fi
48
49if egrep '^options.*IPFILTER_LKM' $confdir/$newconfig > /dev/null 2>&1 ; then
50 echo "$newconfig already contains proper options statement..."
51 echo 'You will now need to build a new kernel.'
52else
53 echo "Backing up $newconfig to .bak and adding IPFILTER options..."
54 if [ -f $confdir/$newconfig ]; then
55 mv $confdir/$newconfig $confdir/$newconfig.bak
56 fi
57 if [ -d $archdir/compile/$newconfig ]; then
58 mv $archdir/compile/$newconfig $archdir/compile/$newconfig.bak
59 fi
60 grep -v IPFILTER $confdir/$newconfig.bak | \
61 awk '{print $0} $2=="INET"{print "options IPFILTER_LKM"}' \
62 > $confdir/$newconfig
63
64 echo 'You will now need to run "config" and build a new kernel.'
65fi
66
67exit 0