分类: 系统运维
2008-11-04 18:13:52
写于2007年12.6号今天整理一下发上来如果有错希望大家指教,呵呵
|
#!/bin/bash
#wds
#2007.12.6
clear
echo "Please wait ................................"
kernel=$(uname -r)
version=$(echo $kernel | cut -d. -f2)
if [ "$version" -eq 6 ]
then
dir_down=$(pwd);
dir=$(pwd)/src
linux_bz2=$(ls linux-* | awk -F".tar" '{print $1}');
iptables_bz2=$(ls iptables-* | awk -F".tar" '{print $1}');
patch_bz2=$(ls patch-o-matic-ng-* | awk -F".tar" '{print $1}');
netfilter_bz2=$(ls netfilter-* | awk -F".tar" '{print $1}');
#-----------------------------------------------------------------------------------------------
export KERNEL_DIR=$dir/$linux_bz2;
export IPTABLES_DIR=$dir/$iptables_bz2;
export PATCH_O_MATIC_NG=$dir/$patch_bz2;
#------------------------------------------------------------------------------------------------
[ ! -e /$dir ] && mkdir -p $dir
[ ! -e /$dir/$linux_bz2 ] && tar -jxf ${linux_bz2}.tar.bz2 -C $dir
[ ! -e /$dir/$iptables_bz2 ] && tar -jxf ${iptables_bz2}.tar.bz2 -C $dir
[ ! -e /$dir/$netfilter_bz2 ] && tar -zxf ${netfilter_bz2}.tar.gz -C $dir
[ ! -e /$dir/$patch_bz2 ] && tar -jxf ${patch_bz2}.tar.bz2 -C $dir
#-update-kernel-----------------------------------------------------------------------------------
cd $dir/$linux_bz2
patch -p1 <../$netfilter_bz2/kernel-2.6.13-2.6.16-layer7-2.2.patch > /dev/null
wait
#-update-iptables---------------------------------------------------------------------------------
cd $dir/$iptables_bz2
patch -p1 <../$netfilter_bz2/iptables-layer7-2.2.patch > /dev/null
wait
#-update-patch----------------------------------------------------------------------------------------------
cd $dir/$patch_bz2
echo "y" | ./runme ipp2p
wait
echo "y" | ./runme time
wait
echo "y" | ./runme connlimit
wait
echo "y" | ./runme random
wait
#-make-kernel----------------------------------------------------------------------------------------c
cd $dir/$linux_bz2
echo "`pwd` is you address:"
else
echo "you kernel is not supper"
fi