2 # this can help you create/update your fedora mirror
5 LOGDIR=/var/log/fedora-mirror
6 DATE=$(date '+%Y-%m-%d-%H-%M')
7 LOG=${LOGDIR}/${DATE}.log
16 us_fedora_url=rsync://mirrors.kernel.org/fedora
17 eu_fedora_url=rsync://mirror1.hs-esslingen.de/fedora/linux
19 default_distroname="f22"
20 all_distronames="f21 f22"
25 fedora_url=$eu_fedora_url
27 function mirror_distro_arch () {
31 distroname=$(echo $distroname | tr '[A-Z]' '[a-z]')
34 distroindex=$(echo $distroname | sed -e "s,f,,g")
39 echo "WARNING -- Unknown distribution $distroname -- skipped"
44 excludelist="debug/ iso/ ppc/ source/"
46 [ -n "$(rsync --help | grep no-motd)" ] && options="$options --no-motd"
47 options="$options $dry_run $verbose"
48 options="$options -aH --numeric-ids"
49 options="$options --delete --delete-excluded --delete-after --delay-updates"
50 for e in $excludelist; do
51 options="$options --exclude $e"
54 echo ">>>>>>>>>>>>>>>>>>>> distroname=$distroname arch=$arch rsyncurl=$rsyncurl"
55 [ -n "$verbose" ] && echo "rsync options=$options"
58 [ -z "$skip_core" ] && paths="releases/$distroindex/Everything/$arch/os/"
59 paths="$paths updates/$distroindex/$arch/"
62 for repopath in $paths; do
63 echo "===== $distro -> $distroindex $repopath"
64 [ -z "$dry_run" ] && mkdir -p ${root}/${localpath}/${repopath}
65 command="rsync $options ${rsyncurl}/${repopath} ${root}/${localpath}/${repopath}"
70 echo "<<<<<<<<<<<<<<<<<<<< $distroname $arch"
76 echo "Usage: $COMMAND [-n] [-v] [-l] [-c] [-e|-s|-u rsyncurl] [-f distroname|-F]"
79 echo " -v : turn off verbose"
80 echo " -l : turns on autologging in $LOGDIR"
81 echo " -c : also sync core repository (releases)"
82 echo " -s : uses US mirror $us_fedora_url"
83 echo " -e : uses EU mirror $eu_fedora_url"
84 echo " -u <url> : use this (rsync) for fedora (default is $fedora_url)"
85 echo " -f distroname - default is $default_distroname"
86 echo " -F : do on all distros $all_distronames"
92 for distroname in $distronames ; do
93 for arch in $archs; do
94 mirror_distro_arch "$distroname" "$arch" || RES=1
103 while getopts "nvlc:u:sef:Fh" opt ; do
105 n) dry_run=--dry-run ;;
109 u) fedora_url=$OPTARG ;;
110 s) fedora_url=$us_fedora_url ;;
111 e) fedora_url=$eu_fedora_url ;;
112 f) distronames="$distronames $OPTARG" ;;
113 F) distronames="$distronames $all_distronames" ;;
118 [[ -n "$@" ]] && usage
119 [ -z "$distronames" ] && distronames=$default_distroname
121 # auto log : if specified
122 if [ -n "$log" ] ; then
128 if [ "$?" == 0 ]; then
129 # report to fedora's infra
130 # can't get the config right...
131 #/usr/bin/report_mirror