脚本:
#!/bin/bash
VER='7'
ARCH='x86_64'
CENTOS_REPOS=(os updates extras centosplus)
for REPO in ${CENTOS_REPOS[@]}
do
/usr/bin/rsync -avz --delete --exclude='repodata' rsync://mirrors.ustc.edu.cn/centos/${VER}/${CENTOS_REPOS}/${ARCH}/ /data/centosnew/centos/${VER}/${CENTOS_REPOS}/${ARCH}/
createrepo /data/centosnew/centos/${VER}/${CENTOS_REPOS}/${ARCH}/
done
rsync -avz --delete --exclude='repodata' rsync://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-7 /data/centosnew/centos/
rsync -avz --delete --exclude='repodata' rsync://mirrors.ustc.edu.cn/epel/7/x86_64/ /data/centosnew/epel/7/x86_64/
createrepo /data/centosnew/epel/7/x86_64/
rsync -avz --delete --exclude='repodata' rsync://mirrors.ustc.edu.cn/epel/RPM-GPG-KEY-EPEL-7 /data/centosnew/epel/
rsync -avz --delete --exclude='repodata' rsync://mirrors.ustc.edu.cn/centos/7/os/x86_64/ /data/centosnew/centos/7/os/x86_64/
后续补充……