Friday, May 30, 2008

Script to apply a patch to NS-2

This script will apply any patch the user wants. Just give URL of the patch when the script asks.


# Downloading the requested patch
cd ~/.
cd ns-2
mkdir tempPatch
cd tempPatch
echo "Give the URL of patch. I will download and patch it for you."
read ans
sudo wget $ans
dir1="$HOME/ns-2/tempPatch/"
dir2=$HOME/ns-2/ns-allinone-2.31/ns-2.31/
file=$dir1/*
cp $file $dir2
cd $dir2


# Applying the patch
make clean
patch -p1 < $file
rm -rf $HOME/ns-2/tempPatch
sudo make
sudo make install

No comments: