2 # this can help you create/update your fedora mirror
12 us_fedora_url=rsync://mirrors.kernel.org/fedora
14 us_centos_url=rsync://mirrors.rit.edu/centos
16 eu_fedora_url=rsync://ftp-stud.hs-esslingen.de/fedora/linux
17 eu_centos_url=rsync://mirrors.ircam.fr/CentOS
20 jp_fedora_url="need-to-be-defined"
22 jp_centos_url="need-to-be-defined"
25 all_distronames="f7 f8 f9 centos5.2"
27 all_archs="i386 x86_64"
31 fedora_url=$eu_fedora_url ; centos_url=$eu_centos_url ;;
33 fedora_url=$jp_fedora_url ; centos_url=$jp_centos_url ;;
35 fedora_url=$us_fedora_url ; centos_url=$us_centos_url ;;
38 function mirror_distro_arch () {
42 distroname=$(echo $distroname | tr '[A-Z]' '[a-z]')
45 distroindex=$(echo $distroname | sed -e "s,fc,,g")
50 distroindex=$(echo $distroname | sed -e "s,f,,g")
54 centos[4-5]|centos[4-5].[0-9])
55 distroindex=$(echo $distroname | sed -e "s,centos,,g")
60 echo "WARNING -- Unknown distribution $distroname -- skipped"
65 excludelist="debug/ iso/ ppc/ source/"
66 options="--archive --compress --delete --delete-excluded $dry_run $verbose"
67 [ -n "$(rsync --help | grep no-motd)" ] && options="$options --no-motd"
68 for e in $excludelist; do
69 options="$options --exclude $e"
72 if [ -n "$verbose" ] ; then
74 echo "distro=$distroname"
75 echo "distroname=$distroname"
76 echo "distroindex=$distroindex"
78 echo rsyncurl="$rsyncurl"
79 echo "rsync options=$options"
88 [ -z "$skip_core" ] && paths="core/$distroindex/$arch/os/"
89 paths="$paths core/updates/$distroindex/$arch/ extras/$distroindex/$arch/"
93 [ -z "$skip_core" ] && paths="releases/$distroindex/Everything/$arch/os/"
94 paths="$paths updates/$distroindex/$arch/"
95 # f8 and f9 have the additional newkey repo
97 8|9) paths="$paths updates/$distroindex/${arch}.newkey/" ;;
108 [ -z "$skip_core" ] && paths="$distroindex/os/$arch/"
109 paths="$paths $distroindex/updates/$arch/"
118 if [ "$RES" = 1 ] ; then
119 echo "DISTRIBUTION $distro $distroindex CURRENTLY UNSUPPORTED - skipped"
121 for repopath in $paths; do
122 echo "============================== $distro -> $distroindex $repopath"
123 [ -z "$dry_run" ] && mkdir -p ${root}/${localpath}/${repopath}
124 command="rsync $options ${rsyncurl}/${repopath} ${root}/${localpath}/${repopath}"
134 echo "Usage: $COMMAND [-n] [-v] [-c] [-r root] [-u|U rsyncurl] [-e|-j] [-f distroname|-F] [-a arch|-A]"
135 echo "Defaults to -r $root -f $default_distroname -a $default_arch"
136 echo "Default urls : $fedora_url $centos_url"
140 echo " -c : skips core repository"
141 echo " -r root (default is $root)"
142 echo " -u rsyncurl for fedora (default is $fedora_url)"
143 echo " -U rsyncurl for centos (default is $centos_url)"
144 echo " -e : uses European mirrors $eu_fedora_url $eu_centos_url"
145 echo " -j : uses Japanese mirrors $jp_fedora_url $jp_centos_url"
146 echo " -f distroname - use vserver convention, e.g. fc6 and f7"
147 echo " -F : for distroname in $all_distronames"
148 echo " -a arch - use yum convention"
149 echo " -A : for arch in $all_archs"
156 while getopts "nvcr:u:U:ef:Fa:Ah" opt ; do
158 n) dry_run=--dry-run ; verbose=--verbose ;;
159 v) verbose=--verbose ;;
162 u) fedora_url=$OPTARG ;;
163 U) centos_url=$OPTARG ;;
164 e) fedora_url=$eu_fedora_url ; centos_url=$eu_centos_url ;;
165 j) fedora_url=$jp_fedora_url ; centos_url=$jp_centos_url ;;
166 f) distronames="$distronames $OPTARG" ;;
167 F) distronames="$distronames $all_distronames" ;;
168 a) archs="$archs $OPTARG" ;;
169 A) archs="$archs $all_archs" ;;
173 [ -z "$distronames" ] && distronames=$default_distroname
174 [ -z "$archs" ] && archs=$default_arch
177 for distroname in $distronames ; do
178 for arch in $archs; do
179 mirror_distro_arch "$distroname" "$arch" || RES=1