#!/bin/bash

tag=$(echo "ldv$version" | sed -s 's/\./-/g')
DDIR=$PWD
VER="2.6.18.1"

if [ ! -z "$1" ]; then
  VER="$1"
fi

KERN="/usr/src/linux-$VER"

if [ ! -d $KERN ]; then
  KERN="/usr/src/kernels/$VER"
fi

make clean

cd $DDIR

echo "Trying to compile for $VER"
./svncompile --with-kernel=$KERN \
             --with-build=/lib/modules/$VER/build \
	     --with-debug=basic

echo "Continue? (Ctrl-C to abort)"
read i

echo "Copying sources to all machines:"

#ssh $USER@vidal.ipv4.liberouter.org rm -v /home/shared/liberouter/kernel/Linux/combo6-modules/*
find $DDIR/build -name "*.ko" -exec chmod a+x {} \;
scp `find $DDIR/build -name "*.ko"` $USER@vidal.ipv4.liberouter.org:/home/shared/liberouter/Linux-2.6.9-11.EL/lib/modules/$VER/kernel/drivers/net/combo6/

exit 0
