создать локальный репозиторий CentOS 5.x/6.x/7.x

#!/bin/sh
CURL_OPTS='-x socks5h://10.35.215.218:443 -sS'

file_html=/tmp/index.html
file_rpms=/tmp/rpm_files.lst
file_rpms_local=/tmp/rpm_files_local.lst

for TYPE in updates extras; do
    mirror_base_url=http://vault.centos.org/5.11/${TYPE}/x86_64/RPMS/
    local_rpm_directory=/var/www/repo.gd.rt.ru/CentOS/5/${TYPE}

    echo "type=${TYPE}"

    rm -f ${file_html} ${file_rpms}
    curl ${CURL_OPTS} ${mirror_base_url} -o ${file_html}
    grep -Po '(?<=href=")[^"]*' $file_html | grep 'x86_64.rpm' | sort -n > $file_rpms

    ls -1 ${local_rpm_directory} | sort -n > ${file_rpms_local}

if [[ $(stat -c%s ${file_rpms_local}) != $(stat -c%s ${file_rpms}) ]]; then
    echo "Downloading.."
#    diff ${file_rpms_local} ${file_rpms}
    sed -i -e "s|^|${mirror_base_url}|" ${file_rpms}
    cd ${local_rpm_directory}

    xargs -n 1 curl ${CURL_OPTS} -O < ${file_rpms}
    rm -f ${file_html} ${file_rpms}
else
    echo "Nothing to do."
fi
done​