#! /bin/bash
echo "This script will copy an entire working Axis SDK2.01 tree on another one."
if [ "$1" = "" -o "$2" = "" ]; then
echo "Usage: cpsdk201 source_dir destination_dir."
else 
echo "Now the tree $1 will be copied on $2. Is this correct? (y/n)"
read ans
if [ "$ans" = "y" ]; then
echo "Copying ...."
cp -r -d $1 $2
cd $2
WRKDIR=$(pwd)
echo "pwd = $WRKDIR"
echo "Press a key to continue .."
read ans
. ./init_env
./configure
echo "Press a key to continue .."
read ans
make clean
echo "Press a key to continue .."
read ans
cd $WRKDIR/apps/iptables
make clean
echo "Press a key to continue .."
read ans
cd $WRKDIR/apps
rm -rfd crypto
echo "Press a key to continue .."
read ans
cd ..
cd $WRKDIR/os/linux
make clean
echo "Press a key to continue .."
read ans
cd $WRKDIR/os/linux-2.6
make clean
echo "Press a key to continue .."
read ans
cd $WRKDIR/tools
rm -rfd build*
echo "Press a key to continue .."
read ans
cd $WRKDIR
./configure
echo "Press a key to continue .."
read ans
make
else
echo "Nothing done: exit."
fi
fi
exit 0

