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 centos5.1"
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/"
104 [ -z "$skip_core" ] && paths="$distroindex/os/$arch/"
105 paths="$paths $distroindex/updates/$arch/"
114 if [ "$RES" = 1 ] ; then
115 echo "DISTRIBUTION $distro $distroindex CURRENTLY UNSUPPORTED - skipped"
117 for repopath in $paths; do
118 echo "============================== $distro -> $distroindex $repopath"
119 [ -z "$dry_run" ] && mkdir -p ${root}/${localpath}/${repopath}
120 command="rsync $options ${rsyncurl}/${repopath} ${root}/${localpath}/${repopath}"
130 echo "Usage: $COMMAND [-n] [-v] [-c] [-r root] [-u|U rsyncurl] [-e|-j] [-f distroname|-F] [-a arch|-A]"
131 echo "Defaults to -r $root -u $rsyncurl -f $default_distroname -a $default_arch"
135 echo " -c : skips core repository"
136 echo " -r root (default is $root)"
137 echo " -u rsyncurl for fedora (default is $fedora_url)"
138 echo " -U rsyncurl for centos (default is $centos_url)"
139 echo " -e : uses European mirrors $eu_fedora_url $eu_centos_url"
140 echo " -j : uses Japanese mirrors $jp_fedora_url $jp_centos_url"
141 echo " -f distroname - use vserver convention, e.g. fc6 and f7"
142 echo " -F : for distroname in $all_distronames"
143 echo " -a arch - use yum convention"
144 echo " -A : for arch in $all_archs"
151 while getopts "nvcr:u:U:ef:Fa:Ah" opt ; do
153 n) dry_run=--dry-run ; verbose=--verbose ;;
154 v) verbose=--verbose ;;
157 u) fedora_url=$OPTARG ;;
158 U) centos_url=$OPTARG ;;
159 e) fedora_url=$eu_fedora_url ; centos_url=$eu_centos_url ;;
160 j) fedora_url=$jp_fedora_url ; centos_url=$jp_centos_url ;;
161 f) distronames="$distronames $OPTARG" ;;
162 F) distronames="$distronames $all_distronames" ;;
163 a) archs="$archs $OPTARG" ;;
164 A) archs="$archs $all_archs" ;;
168 [ -z "$distronames" ] && distronames=$default_distroname
169 [ -z "$archs" ] && archs=$default_arch
172 for distroname in $distronames ; do
173 for arch in $archs; do
174 mirror_distro_arch "$distroname" "$arch" || RES=1