#!/bin/sh

package=$1

test -z "$package" && echo "Usage: $0 <package>" && exit

test -d files || mkdir -p files
for list in `egrep -ir "$package-[[:digit:]]" lists |cut -d':' -f1`; do
    for file in `egrep -i "$package-[[:digit:]]" $list |cut -b44-`; do
	test -f "files/$file" && continue
	path=`echo $list | tr '-' '/' | sed -e 's,^lists/,,g'`
	echo "$path/$file"
	rsync -qz rsync.altlinux.org::archive/Sisyphus/$path/$file files/
    done
done
