blob: fa9e3674b469e59ea83305d271c3151b2a76a8ca [file] [log] [blame] [raw]
#! /bin/sh
#
# kinstall/minstall - install patches to kernel sources
#
# WARNING: This script should be run exactly once on a virgin system
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin; export PATH
# try to bomb out fast if anything fails....
set -e
argv0=`basename $0`
dir=`pwd`
karch=`uname -m`
archdir="/sys/arch/$karch"
confdir="$archdir/conf"
case "$dir" in
*/NetBSD )
cd ..
;;
esac
echo -n "Installing "
for i in ip_fil.[ch] ip_nat.[ch] ip_frag.[ch] ip_state.[ch] fil.c ip_compat.h ip_proxy.[ch] ip_{ftp,rcmd}_pxy.c ip_auth.[ch] ip_log.c; do
echo -n "$i "
cp $i /sys/netinet/
chmod 644 /sys/netinet/$i
switch ($i)
case *.h:
/bin/cp $i /usr/include/netinet/$i
chmod 644 /usr/include/netinet/$i
breaksw
endsw
done
echo
echo "Patching ip_input.c, ip_output.c and in_proto.c ..."
cat NetBSD/ip*.c.diffs | (cd /sys/netinet; patch)
if [ -f /sys/conf/files.newconf ]; then
echo "Patching in_proto.c ..."
cat NetBSD/in_proto.c.old.diffs | (cd /sys/netinet; patch)
echo "Patching $archdir/$karch/conf.c"
cat NetBSD/conf.c.old.diffs | (cd $archdir/$karch; patch)
echo "Patching /sys/conf/files.newconf ..."
cat NetBSD/files.newconf.diffs | (cd /sys/conf; patch)
echo "Patching /sys/conf/files ..."
cat NetBSD/files.diffs | (cd /sys/conf; patch)
fi
if [ -f /sys/conf/files.oldconf ]; then
echo "Patching in_proto.c ..."
cat NetBSD/in_proto.c.diffs | (cd /sys/netinet; patch)
echo "Patching $archdir/$karch/conf.c"
cat NetBSD/conf.c.diffs | (cd $archdir/$karch; patch)
echo "Patching /sys/conf/files.oldconf ..."
cat NetBSD/files.oldconf.diffs | (cd /sys/conf; patch)
echo "Patching /sys/conf/files ..."
cat NetBSD/filez.diffs | (cd /sys/conf; patch)
fi
echo -n "Kernel configuration to update [GENERIC] "
read newconfig junk
if [ -n "$newconfig" ] ; then
config="$confdir/$newconfig"
else
newconfig="$confdir/GENERIC"
fi
if egrep 'options.*IPFILTER' $confdir/$newconfig > /dev/null 2>&1 ; then
echo "$newconfig already contains proper options statement..."
echo 'You will now need to build a new kernel.'
else
echo "Backing up $newconfig to .bak and adding IPFILTER options..."
if [ -f $confdir/$newconfig ]; then
mv $confdir/$newconfig $confdir/$newconfig.bak
fi
if [ -d $archdir/compile/$newconfig ]; then
mv $archdir/compile/$newconfig $archdir/compile/$newconfig.bak
fi
awk '{print $0} $2=="INET"{print "options IPFILTER"}' \
$confdir/$newconfig.bak > $confdir/$newconfig
echo 'You will now need to run "config" and build a new kernel.'
fi
exit 0