X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=update-archive%2Fupdate-yum-archive.sh;h=4983186aceb98a30cce3ae79fea735401b88b2a8;hb=1c4bc62a01356a456568cc5fb3b0c947b1f7bbc2;hp=9d49d260c4c62f65ddbf515bc027fbf0fbef4ab4;hpb=b57b442d5bd40c37bc8314d498f05c4b72b7edad;p=git-tools-moved-to-github.git diff --git a/update-archive/update-yum-archive.sh b/update-archive/update-yum-archive.sh index 9d49d26..4983186 100755 --- a/update-archive/update-yum-archive.sh +++ b/update-archive/update-yum-archive.sh @@ -19,12 +19,19 @@ if test ! -x /usr/bin/gpg; then exit 1 fi +if test ! -x /usr/bin/expect; then + echo "$0: /usr/bin/expect missing. Install expect" + exit 1 +fi + +now=`date +%s` +# sign if newer than signage (86400=24 hrs) +signage=8000 #check if root has rpm macros confdir=`pwd` -pkgs_to_sign="" architectures="i386 x86_64" dirs_to_upd="" -for vdist in centos/5.5 rhel/5.5; do +for vdist in centos/5.5 rhel/5.5 centos/6; do dist=`basename $vdist` vendor=`dirname $vdist` ftpdir=/home/ftp/pub/yum/$vendor/$dist @@ -58,7 +65,6 @@ for vdist in centos/5.5 rhel/5.5; do 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 @@ -72,7 +78,7 @@ for vdist in centos/5.5 rhel/5.5; do if test -d $distdir; then if test -d $distdir/SRPMS; then for f in $distdir/SRPMS/*.src.rpm; do - if test -f $f; then + if test -f $f; then ln -sf $f $d/SRPMS/ fi done @@ -80,10 +86,31 @@ for vdist in centos/5.5 rhel/5.5; do for arch in $architectures; do mkdir -p $d/${arch}/Packages for f in $distdir/RPMS/${arch}/*.rpm $distdir/RPMS/noarch/*.rpm; do + b=`basename $f` if test -f $f; then - pkgs_to_sign="${pkgs_to_sign} $f" - ln -sf $f $d/${arch}/Packages/ - has_packages=true + mustsign=false + age=`stat --printf='%Y' $f` + if expr $now - $age \< $signage >/dev/null; then + mustsign=true + fi + if test ! -f $d/${arch}/Packages/$b; then + mustsign=true + fi + if $mustsign; then + ln -sf $f $d/${arch}/Packages/ + if rpm -K $f|grep -q 'GPG' >/dev/null; then + echo "Already signed $f" + else + expect << __EOF + spawn rpm --addsign $f +expect -exact "Enter pass phrase: " +send -- "\r" +expect eof +__EOF + chgrp staff $f + chmod g+w $f + fi + fi fi done done @@ -92,15 +119,14 @@ for vdist in centos/5.5 rhel/5.5; do done done done -echo "Signing pakages (default ID PPH is empty):" -rpm --addsign ${pkgs_to_sign} -chgrp staff ${pkgs_to_sign} -chmod g+w ${pkgs_to_sign} echo "Updating repository meta:" for rdir in ${dirs_to_upd}; do echo "Section ${rdir}" if test -d $rdir && ls -A $rdir; then - createrepo --update ${rdir} + # Get rid of createrepo warnings + # https://bugs.launchpad.net/ubuntu/+source/createrepo/+bug/530015 + createrepo --update ${rdir} 2>&1 | + grep -v DeprecationWarning:|grep -v ' import' if test -f ${rdir}/repodata/repomd.xml.asc; then rm ${rdir}/repodata/repomd.xml.asc fi