Skip to content

Instantly share code, notes, and snippets.

@jobicoppola
Created June 24, 2015 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jobicoppola/f4c3d99972cb79f241df to your computer and use it in GitHub Desktop.
Save jobicoppola/f4c3d99972cb79f241df to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Script to create a local CentOS mirror
#
rsync="/usr/bin/rsync -aqzH --delete --delete-after --delay-updates"
mirror=rsync://mirror.linux.duke.edu/centos
versionlist="5.11 6.6"
archlist="x86_64"
baselist_5="os updates extras centosplus contrib fasttrack addons"
baselist_6="os updates extras centosplus contrib fasttrack"
local=/home/osfilesweb/osfilesweb/htdocs/repos/centos
for version in $versionlist
do
majorversion=${version%.*}
for arch in $archlist
do
baselist="baselist_${majorversion}"
eval baselist=\$$baselist
for base in $baselist
do
subdir=$version/$base/$arch/
if [ ! -d $local/$subdir ]; then
mkdir -p $local/$subdir
fi
remote=$mirror/$subdir
$rsync $remote $local/$subdir
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment