X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=update-archive%2Fupdate-yum-archive.sh;h=f280e645fdf6c224d2c7cdcedf5b3c8e0ff12bc4;hb=1d9b47904353cc22e677532f673a284ff5c8078f;hp=4010b7b47f1a6defb7b10c6f06cf119fcd7faa19;hpb=4e5de54c0c7287da07da76755349becd820ce9d1;p=git-tools-moved-to-github.git diff --git a/update-archive/update-yum-archive.sh b/update-archive/update-yum-archive.sh index 4010b7b..f280e64 100755 --- a/update-archive/update-yum-archive.sh +++ b/update-archive/update-yum-archive.sh @@ -24,11 +24,14 @@ if test ! -x /usr/bin/expect; then exit 1 fi +now=`date +%s` +# sign if newer than signage (86400=24 hrs) +signage=8000 #check if root has rpm macros confdir=`pwd` 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 @@ -83,19 +86,30 @@ 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 - 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 + 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 + chgrp staff $f + chmod g+w $f + fi fi fi done