Skip to content

Instantly share code, notes, and snippets.

@iandexter
Created December 13, 2012 03:04
Show Gist options
  • Save iandexter/4273697 to your computer and use it in GitHub Desktop.
Save iandexter/4273697 to your computer and use it in GitHub Desktop.
yum install httpd yum-utils createrepo
cat > reposync.patch
--- /usr/bin/reposync.bak 2012-11-13 13:30:37.000000000 +0800
+++ /usr/bin/reposync 2012-11-13 13:34:47.000000000 +0800
@@ -117,6 +117,8 @@ def parseArgs():
help="enable yum plugin support")
parser.add_option("-m", "--downloadcomps", default=False, action="store_true",
help="also download comps.xml")
+ parser.add_option("-f", "--flatdir", dest='flatdir', default=False, action="store_true",
+ help="flatten directory; do not add repoid")
(opts, args) = parser.parse_args()
return (opts, args)
@@ -186,7 +188,11 @@ def main():
else:
download_list = list(reposack)
- local_repo_path = opts.destdir + '/' + repo.id
+ if opts.flatdir:
+ local_repo_path = opts.destdir;
+ else:
+ local_repo_path = opts.destdir + '/' + repo.id
+
if opts.delete and os.path.exists(local_repo_path):
current_pkgs = localpkgs(local_repo_path)
cp /usr/bin/reposync{,.bak}
patch < reposync.patch
mkdir -p /srv/repos/epel{,.staging}/5/{x86_64,i386,noarch}
reposync -a x86_64 -r epel -p /srv/repos/epel.staging -l -m -f
cd /srv/repos/epel.staging/
for a in {x86_64,i386,noarch} ; do \
find . -maxdepth 1 -iname "*$a*" -exec cp -v {} 5/$a/ \; ; \
cp -f comps.xml 5/$a/ ;
done
for a in {x86_64,i386,noarch} ; do \
createrepo -v -g comps.xml 5/$a/ ; \
done
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
baseurl=http://fqdn.of.repo.server/epel/5/$basearch
### mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
<VirtualHost _default_:80>
ServerAdmin admin@email.org
ServerName fqdn.of.repo.server
DocumentRoot /srv/repos
KeepAlive On
KeepAliveTimeout 2
MaxKeepAliveRequests 100
AddType application/octet-stream .iso
AddType application/octet-stream .rpm
<Directory "/srv/repos">
Options +Indexes +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<LocationMatch "\.(xml|xml\.gz|xml\.asc|sqlite)$">
Header set Cache-Control "must-revalidate"
ExpiresActive On
ExpiresDefault "now"
</LocationMatch>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" %I %O \"%{User-Agent}i\"" combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment