#!/bin/bash -e

for repo in /etc/yum.repos.d/rpmfusion*.repo; do
	if [ -e "${repo}.orig" ]; then
		continue
	fi

	echo "Patch ${repo}"

	sed -r -i.orig \
	    -e 's@^metalink=@#&@' \
	    -e 's@^#baseurl=http://download1.rpmfusion.org/([^/]+)/(.*)@&\nbaseurl=http://rhlx01.hs-esslingen.de/Mirrors/archive.rpmfusion.org/\1-archive/\2@' \
	    "${repo}"
done
