#!/bin/sh
TEMPSPECDIR="/www/www.linux.kiev.ua/html/devel/RPM/SPECS/.tmp"
SRPMPREFIX="/var/ftp/pub/Linux/ALT/Sisyphus/SRPMS."
SPECPREFIX="/www/www.linux.kiev.ua/html/devel/RPM/SPECS/"
#REPOS="base castle contrib junior kernel master non-free"
#REPOS="base"
REPOS="classic"
rm -rf "$TEMPSPECDIR"
rm -rf "$SPECPREFIX"
mkdir -p "$TEMPSPECDIR"
cd "$TEMPSPECDIR"
for repo in $REPOS; do
mkdir -p "$SPECPREFIX$repo"
for srpm in $SRPMPREFIX$repo/*.src.rpm; do
rpm2cpio "$srpm" | cpio --quiet --extract *.spec
spec="`rpmquery --qf='%{NAME}' -p "$srpm"`.spec"
[ -f *.spec ] && chmod 644 *.spec
mv -f *.spec "$SPECPREFIX$repo/$spec" || echo "$srpm"
done
done