Mirroring CentOS
I need a local mirror of CentOS again. But I only want CentOS 5. I’ve done this before, but I figure I should post the script so that I don’t have to write it from scratch again next time.
#!/bin/bash # change to limit# bandwidthBWLIMIT=256 # call the script with '1' or something# to make it display progressVERBOSE=$1 # these can all be lists of# the sub trees you're looking forVER="5"ARCHLIST="i386 x86_64"BASELIST="os updates" # where is your local repo?LOCAL=/tmp/centos RSYNC=rsync # mirrir list available at http://www.centos.org/modules/tinycontent/index.php?id=13MIRROR="rsync.FIXME::centos" rsync_cmd="$RSYNC -aHz --delete" if [ "x$VERBOSE" = "x" ]; then rsync_cmd="$rsync_cmd -q"else rsync_cmd="$rsync_cmd -v --progress"fi if [ "x$BWLIMIT" != "x" ]; then rsync_cmd="$rsync_cmd --bwlimit=$BWLIMIT"fi for ver in $VER; do for arch in $ARCHLIST; do for base in $BASELIST; do if [ ! -d $LOCAL/$ver/$base/$arch/ ]; then mkdir -p $LOCAL/$ver/$base/$arch/ fi $rsync_cmd $MIRROR/$ver/$base/$arch/ $LOCAL/$ver/$base/$arch/ done donedone
This is based on the original I found on the CentOS Mirroring page by a somewhat anonymous jlar310.
My script is nice because you can run it silently as a cron, or pass -v (or anything, really) on the command line and watch it go.

