1#!/bin/csh -f
2#
3set dir=`pwd`
4set karch=`uname -m`
5if ( -d /sys/arch/$karch ) set archdir="/sys/arch/$karch"
6if ( -d /sys/$karch ) set archdir="/sys/$karch"
7set confdir="$archdir/conf"
8
9if ( $dir =~ */FreeBSD* ) cd ..
10echo -n "Installing "
11foreach i (ip_fil.[ch] ip_nat.[ch] ip_frag.[ch] ip_state.[ch] fil.c \
12	   ip_proxy.[ch] ip_{ftp,rcmd,raudio}_pxy.c mlf_ipl.c ipl.h \
13	   ip_compat.h ip_auth.[ch] ip_log.c)
14	echo -n "$i ";
15	cp $i /sys/netinet
16	chmod 644 /sys/netinet/$i
17	switch ($i)
18	case *.h:
19		/bin/cp $i /usr/include/netinet/$i
20		chmod 644 /usr/include/netinet/$i
21		breaksw
22	endsw
23end
24echo ""
25echo "Linking /usr/include/osreldate.h to /sys/sys/osreldate.h"
26ln -s /usr/include/osreldate.h /sys/sys/osreldate.h
27
28set config=`(cd $confdir; /bin/ls -1t [0-9A-Z_]*) | head -1`
29echo -n "Kernel configuration to update [$config] "
30set newconfig=$<
31if ( "$newconfig" != "" ) then
32	set config="$confdir/$newconfig"
33else
34	set newconfig=$config
35endif
36echo "Rewriting $newconfig..."
37if ( -f $confdir/$newconfig ) then
38	mv $confdir/$newconfig $confdir/$newconfig.bak
39endif
40if ( -d $archdir/../compile/$newconfig ) then
41	set bak=".bak"
42	set dot=0
43	while ( -d $archdir/../compile/${newconfig}.${bak} )
44		set bak=".bak.$dot"
45		set dot=`expr 1 + $dot`
46	end
47	mv $archdir/../compile/$newconfig $archdir/../compile/${newconfig}.${bak}
48endif
49awk '{print $0;if($2=="INET"){print"options IPFILTER\noptions IPFILTER_LOG"}}'\
50	$confdir/$newconfig.bak > $confdir/$newconfig
51echo "You will now need to run config on $newconfig and build a new kernel."
52exit 0
53