+us_fedora_url=rsync://mirrors.kernel.org/fedora
+# change this
+us_centos_url=rsync://mirrors.rit.edu/centos
+
+eu_fedora_url=rsync://ftp-stud.hs-esslingen.de/fedora/linux
+eu_centos_url=rsync://mirrors.ircam.fr/CentOS
+
+# change this
+jp_fedora_url="need-to-be-defined"
+# change this
+jp_centos_url="need-to-be-defined"
+
+default_distroname=f8
+all_distronames="f7 f8 f9 centos5.1"
+default_arch=i386
+all_archs="i386 x86_64"
+
+case $(hostname) in
+ *.fr|*.de|*.uk)
+ fedora_url=$eu_fedora_url ; centos_url=$eu_centos_url ;;
+ *.jp)
+ fedora_url=$jp_fedora_url ; centos_url=$jp_centos_url ;;
+ *)
+ fedora_url=$us_fedora_url ; centos_url=$us_centos_url ;;
+esac
+
+function mirror_distro_arch () {
+ distroname=$1; shift
+ arch=$1; shift
+
+ distroname=$(echo $distroname | tr '[A-Z]' '[a-z]')
+ case $distroname in
+ fc*[1-6])
+ distroindex=$(echo $distroname | sed -e "s,fc,,g")
+ distro="Fedora Core"
+ rsyncurl=$fedora_url
+ ;;
+ f*[7-9])
+ distroindex=$(echo $distroname | sed -e "s,f,,g")
+ distro="Fedora"
+ rsyncurl=$fedora_url
+ ;;
+ centos[4-5]|centos[4-5].[0-9])
+ distroindex=$(echo $distroname | sed -e "s,centos,,g")
+ distro="CentOS"
+ rsyncurl=$centos_url
+ ;;
+ *)
+ echo "WARNING -- Unknown distribution $distroname -- skipped"
+ return 1
+ ;;
+ esac
+
+ excludelist="debug/ iso/ ppc/ source/"
+ options="--archive --compress --delete --delete-excluded $dry_run $verbose"
+ [ -n "$(rsync --help | grep no-motd)" ] && options="$options --no-motd"
+ for e in $excludelist; do
+ options="$options --exclude $e"
+ done
+
+ if [ -n "$verbose" ] ; then
+ echo "root=$root"
+ echo "distro=$distroname"
+ echo "distroname=$distroname"
+ echo "distroindex=$distroindex"
+ echo "arch=$arch"
+ echo rsyncurl="$rsyncurl"
+ echo "rsync options=$options"
+ fi
+
+ RES=1
+ paths=""
+ case $distro in
+ [Ff]edora*)
+ case $distroindex in
+ 2|4|6)
+ [ -z "$skip_core" ] && paths="core/$distroindex/$arch/os/"
+ paths="$paths core/updates/$distroindex/$arch/ extras/$distroindex/$arch/"
+ RES=0
+ ;;
+ [7-9])
+ [ -z "$skip_core" ] && paths="releases/$distroindex/Everything/$arch/os/"
+ paths="$paths updates/$distroindex/$arch/"
+ RES=0
+ ;;
+ esac
+ localpath=fedora
+ ;;
+
+ CentOS*)
+ case $distroindex in
+ 5*)
+ [ -z "$skip_core" ] && paths="$distroindex/os/$arch/"
+ paths="$paths $distroindex/updates/$arch/"
+ RES=0
+ ;;
+ esac
+ localpath=centos
+ ;;
+
+ esac
+
+ if [ "$RES" = 1 ] ; then
+ echo "DISTRIBUTION $distro $distroindex CURRENTLY UNSUPPORTED - skipped"
+ else
+ for repopath in $paths; do
+ echo "============================== $distro -> $distroindex $repopath"
+ [ -z "$dry_run" ] && mkdir -p ${root}/${localpath}/${repopath}
+ command="rsync $options ${rsyncurl}/${repopath} ${root}/${localpath}/${repopath}"
+ echo $command
+ $command
+ done
+ fi
+
+ return $RES
+}