From: Jakub Date: Tue, 6 Jul 2010 13:33:01 +0000 (+0200) Subject: Update yum repo script X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=2be2026152c30de5378506d522a71b4255d29bca;p=git-tools-moved-to-github.git Update yum repo script Builds only dir structure right now, does not create repo indices since kebab does not allow installing new packages (createrepo in particular)! The input packages are expected, similarly to debs, under /home/ftp/pub/package-name with the follworinf dir tree: redhat/ - distro - version - SRPMS - RPMS - noarch - i368 - (etc) This structure that reflects what's under /usr/src/redhat/ after the package is built. --- diff --git a/update-archive/update-yum-archve.sh b/update-archive/update-yum-archve.sh new file mode 100755 index 0000000..cd35d91 --- /dev/null +++ b/update-archive/update-yum-archve.sh @@ -0,0 +1,81 @@ +#!/bin/sh +#if test ! -x /usr/bin/createrepo; then +# echo "$0: /usr/bin/createrepo missing. Install createrepo" +# exit 1 +#fi + +confdir=`pwd` +architectures="i386 x86_64" +for vdist in centos/5.5 rhel/5.5; do + dist=`basename $vdist` + vendor=`dirname $vdist` + ftpdir=/home/ftp/pub/yum/$vendor/$dist + if test ! -d $ftpdir; then + echo "$ftpdir does not exist" + exit 1 + fi + cd $ftpdir + sections="" + for section in main restricted; do + # Prepare pool + d=$section + if test ! -d $d; then mkdir -p $d; fi + if test ! -d $d/SRPMS; then mkdir -p $d/SRPMS; fi + # Remove invalid symlinks (SRPMS, i386, x86_64,..) + for l in $d/SRPMS/*; do + if test -L "$l"; then + if test ! -f "$l"; then + rm $l + fi + fi + done + for arch in $architectures; do + for l in $d/$arch/Packages/*; do + if test -L "$l"; then + if test ! -f "$l"; then + rm $l + fi + fi + done + done + # Make symlinks from the regular FTP archive + has_packages=false + for pdir in /home/ftp/pub/*; do + use=false + if test -f $pdir/.htaccess -a $section != "main"; then + use=true + fi + if test ! -f $pdir/.htaccess -a $section = "main"; then + use=true + fi + if $use; then + distdir=$pdir/redhat/$vendor/$dist + if test -d $distdir; then + if test -d $distdir/SRPMS; then + for f in $distdir/SRPMS/*.src.rpm; do + if test -f $f; then + ln -sf $f $d/SRPMS/ + has_packages=true + fi + done + fi + for arch in $architectures; do + mkdir -p $d/${arch}/Packages + for f in $distdir/RPMS/${arch}/*.rpm $distdir/RPMS/noarch/*.rpm; do + if test -f $f; then + ln -sf $f $d/${arch}/Packages/ + has_packages=true + fi + done + done + fi + fi + done + done +done +# Local Variables: +# mode:shell-script +# sh-indentation: 2 +# sh-basic-offset: 8 +# End: +