X-Git-Url: http://git.onelab.eu/?p=build.git;a=blobdiff_plain;f=fedora-mirror.sh;h=7952453e24158ddbe6d832e61cf187dc5d6bd3f2;hp=f3e07f7b199738e336a435feefb08d88070161fd;hb=HEAD;hpb=9d0a440785bc01409c34e5ed881b13affe06b6a4 diff --git a/fedora-mirror.sh b/fedora-mirror.sh index f3e07f7b..c3d6d70b 100755 --- a/fedora-mirror.sh +++ b/fedora-mirror.sh @@ -7,7 +7,7 @@ DATE=$(date '+%Y-%m-%d-%H-%M') LOG=${LOGDIR}/${DATE}.log dry_run= -verbose=--verbose +verbose=-i log= skip_core=true root=/mirror/ @@ -16,8 +16,8 @@ root=/mirror/ us_fedora_url=rsync://mirrors.kernel.org/fedora eu_fedora_url=rsync://mirror1.hs-esslingen.de/fedora/linux -default_distroname="f22" -all_distronames="f20 f21 f22" +default_distroname="f39" +all_distronames="f37 f39" global_arch="x86_64" @@ -30,15 +30,15 @@ function mirror_distro_arch () { distroname=$(echo $distroname | tr '[A-Z]' '[a-z]') case $distroname in - f*) - distroindex=$(echo $distroname | sed -e "s,f,,g") - distro="Fedora" - rsyncurl=$fedora_url - ;; - *) - echo "WARNING -- Unknown distribution $distroname -- skipped" - return 1 - ;; + f*) + distroindex=$(echo $distroname | sed -e "s,f,,g") + distro="Fedora" + rsyncurl=$fedora_url + ;; + *) + echo "WARNING -- Unknown distribution $distroname -- skipped" + return 1 + ;; esac excludelist="debug/ iso/ ppc/ source/" @@ -46,9 +46,10 @@ function mirror_distro_arch () { [ -n "$(rsync --help | grep no-motd)" ] && options="$options --no-motd" options="$options $dry_run $verbose" options="$options -aH --numeric-ids" - options="$options --delete --delete-excluded --delete-after --delay-updates" + options="$options --delete --delete-excluded" + options="$options --partial" for e in $excludelist; do - options="$options --exclude $e" + options="$options --exclude $e" done echo ">>>>>>>>>>>>>>>>>>>> distroname=$distroname arch=$arch rsyncurl=$rsyncurl" @@ -56,20 +57,25 @@ function mirror_distro_arch () { paths="" [ -z "$skip_core" ] && paths="releases/$distroindex/Everything/$arch/os/" - paths="$paths updates/$distroindex/$arch/" - localpath=fedora + if [ "$distroindex" -le 27 ]; then + paths="$paths updates/$distroindex/$arch/" + localpath=fedora + else + paths="$paths updates/$distroindex/Everything/$arch/ updates/$distroindex/Modular/$arch/" + localpath=fedora + fi 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 + echo "===== $distro -> $distroindex $repopath" + [ -z "$dry_run" ] && mkdir -p ${root}/${localpath}/${repopath} + command="rsync $options ${rsyncurl}/${repopath} ${root}/${localpath}/${repopath}" + echo $command + $command done echo "<<<<<<<<<<<<<<<<<<<< $distroname $arch" - return $RES + return $RES } function usage () { @@ -89,10 +95,10 @@ function usage () { function run () { RES=0 - for distroname in $distronames ; do - for arch in $archs; do - mirror_distro_arch "$distroname" "$arch" || RES=1 - done + for distroname in $distronames ; do + for arch in $archs; do + mirror_distro_arch "$distroname" "$arch" || RES=1 + done done return $RES } @@ -100,19 +106,19 @@ function run () { function main () { distronames="" archs="$global_arch" - while getopts "nvlc:u:sef:Fh" opt ; do - case $opt in - n) dry_run=--dry-run ;; - v) verbose= ;; - l) log=true ;; - c) skip_core= ;; - u) fedora_url=$OPTARG ;; - s) fedora_url=$us_fedora_url ;; - e) fedora_url=$eu_fedora_url ;; - f) distronames="$distronames $OPTARG" ;; - F) distronames="$distronames $all_distronames" ;; - h|*) usage ;; - esac + while getopts "nvlcu:sef:Fh" opt ; do + case $opt in + n) dry_run=--dry-run ;; + v) verbose= ;; + l) log=true ;; + c) skip_core= ;; + u) fedora_url=$OPTARG ;; + s) fedora_url=$us_fedora_url ;; + e) fedora_url=$eu_fedora_url ;; + f) distronames="$distronames $OPTARG" ;; + F) distronames="$distronames $all_distronames" ;; + h|*) usage ;; + esac done shift $(($OPTIND-1)) [[ -n "$@" ]] && usage @@ -120,18 +126,18 @@ function main () { # auto log : if specified if [ -n "$log" ] ; then - mkdir -p $LOGDIR - run &> $LOG + mkdir -p $LOGDIR + run &> $LOG else - run - fi + run + fi if [ "$?" == 0 ]; then - # report to fedora's infra - # can't get the config right... - #/usr/bin/report_mirror - exit 0 + # report to fedora's infra + # can't get the config right... + #/usr/bin/report_mirror + exit 0 else - exit 1 + exit 1 fi }