2 # this can help you create/update your fedora mirror
10 root=/data/fedora/linux
12 us_rsyncurl=rsync://mirrors.kernel.org/fedora
13 eu_rsyncurl=rsync://ftp-stud.hs-esslingen.de/fedora/linux
15 jp_rsyncurl=rsync://ftp-stud.hs-esslingen.de/fedora/linux
18 all_distronames="f7 f8"
20 all_archs="i386 x86_64"
24 rsyncurl=$eu_rsyncurl ;;
26 rsyncurl=$jp_rsyncurl ;;
28 rsyncurl=$us_rsyncurl ;;
32 echo "Usage: $COMMAND [-n] [-v] [-c] [-r root] [-u rsyncurl|-e] [-f distroname|-F] [-a arch|-A]"
33 echo "Defaults to -r $root -u $rsyncurl -f $default_distroname -a $default_arch"
37 echo " -c : skips core repository"
38 echo " -r root (default is $root)"
39 echo " -u rsyncurl (default is $rsyncurl)"
40 echo " -e : uses European mirror $eu_rsyncurl"
41 echo " -f distroname - use vserver convention, e.g. fc6 and f7"
42 echo " -F : for distroname in $all_distronames"
43 echo " -a arch - use yum convention"
44 echo " -A : for arch in $all_archs"
48 function mirror_distro_arch () {
54 distroindex=$(echo $distroname | sed -e "s,fc,,g")
58 distroindex=$(echo $distroname | sed -e "s,f,,g")
62 distroindex=$(echo $distroname | sed -e "s,centos,,g")
66 echo "Unknown distribution $distroname - skipped"
70 excludelist="debug/ iso/ ppc/ source/"
71 options="--archive --compress --delete --delete-excluded $dry_run $verbose"
72 [ -n "$(rsync --help | grep no-motd)" ] && options="$options --no-motd"
73 for e in $excludelist; do
74 options="$options --exclude $e"
77 if [ -n "$verbose" ] ; then
79 echo "distro=$distroname"
80 echo "distroname=$distroname"
81 echo "distroindex=$distroindex"
83 echo rsyncurl="$rsyncurl"
84 echo "rsync options=$options"
93 [ -z "$skip_core" ] && paths="core/$distroindex/$arch/os/"
94 paths="$paths core/updates/$distroindex/$arch/ extras/$distroindex/$arch/"
98 [ -z "$skip_core" ] && paths="releases/$distroindex/Everything/$arch/os/"
99 paths="$paths updates/$distroindex/$arch/"
108 [ -z "$skip_core" ] && paths="$distroindex/os/$arch/"
109 paths="$paths $distroindex/updates/$arch/"
117 if [ "$RES" = 1 ] ; then
118 echo "$distro $distroindex currently unsupported - skipped"
120 for repopath in $paths; do
121 echo "============================== $distro -> $distroindex $repopath"
122 [ -z "$dry_run" ] && mkdir -p ${root}/${repopath}
123 command="rsync $options ${rsyncurl}/${repopath} ${root}/${repopath}"
135 while getopts "nvcr:u:ef:Fa:Ah" opt ; do
137 n) dry_run=--dry-run ; verbose=--verbose ;;
138 v) verbose=--verbose ;;
141 u) rsyncurl=$OPTARG ;;
142 e) rsyncurl=$eu_rsyncurl ;;
143 f) distronames="$distronames $OPTARG" ;;
144 F) distronames="$distronames $all_distronames" ;;
145 a) archs="$archs $OPTARG" ;;
146 A) archs="$archs $all_archs" ;;
150 [ -z "$distronames" ] && distronames=$default_distroname
151 [ -z "$archs" ] && archs=$default_arch
154 for arch in $archs; do
155 for distroname in $distronames ; do
156 mirror_distro_arch "$distroname" "$arch" || RES=1