[CentOS] script to make a CentOS 4.0 respository updates server...

Tue Jun 21 01:36:35 UTC 2005
Paul <subsolar at subsolar.com>

On Mon, 2005-06-20 at 14:14 -0500, israel.garcia at cimex.com.cu wrote:
> List, I have a CentOS 4.0 server in my intranet which will serves as a
> CentOS repository updates, so I need a script to do that job, I can not
> use RSYNC. I just want to download CentOS 4.0 updates every night.
> 
> Can you help me?
> 
> Regards,
> Israel
> 

The following script is one I use ...  though it could be optimized to
just download the RPMs and use createrepo to recreate the metadata.

The script I use is as follows:
#!/bin/sh
#
# mirror-centos.sh - Mirror CentOS Linux Updates
#

# Variables
MIRROR="mirror.cs.wisc.edu"
WBDIR="pub/mirrors/linux/caosity.org/centos"
VERSIONS="4"
ARCHS="SRPMS i386 x86_64"
WBUPDATES="/home/ftp/pub/centos"
PROXY="http://firewall.company.com:8080/"

# Limit Transfer Rate to 10K bytes per second
MAXRATE="10k"

# Do the mirror
for d in $VERSIONS; do
  for y in $ARCHS; do
    cd $WBUPDATES
    ## env http_proxy=$PROXY \
    wget --non-verbose --no-host-directories --cut-dirs=8 --mirror \
     --passive-ftp --limit-rate=$MAXRATE \
     --directory-prefix=$WBUPDATES/$d/updates/$y \
     ftp://$MIRROR/$WBDIR/$d/updates/$y 
     ##--output-file=/tmp/mirror-centos.log 

    # the RPMS should be checked for valid sigs, not ready for that yet
    ##rpm --checksig $WBUPDATES/$d/updates/$y/*.rpm | grep 'NOT OK'
  done
done


# Done
exit