#!/bin/sh

DEST=$1
RSYNC="/usr/bin/rsync -rltvz"

if [ "$DEST" = "" ]; then
	echo You must supply a destination directory
	exit
fi

if [ ! -e $DEST ]; then
	echo Destination does not exist: $DEST
	exit
fi

echo Mirroring to $DEST
cd $DEST

if [ ! -d "$DEST/v2.6" ]; then
	mkdir $DEST/v2.6
fi
$RSYNC rsync://rsync.kernel.org/pub/linux/kernel/v2.6/patch-2.6.*.bz2 $DEST/v2.6

if [ -f "$DEST/v2.6/.tarballs" ]; then
	$RSYNC rsync://rsync.kernel.org/pub/linux/kernel/v2.6/linux-2.6.*.tar.bz2 $DEST/v2.6
fi

if [ ! -d "$DEST/v2.6/snapshots" ]; then
	mkdir $DEST/v2.6/snapshots
fi
$RSYNC rsync://rsync.kernel.org/pub/linux/kernel/v2.6/snapshots/*.bz2 $DEST/v2.6/snapshots



if [ ! -d "$DEST/v2.6/testing" ]; then
	mkdir $DEST/v2.6/testing
fi
$RSYNC rsync://rsync.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6*.bz2 $DEST/v2.6/testing