diff --git a/reposync/runreposync.sh b/reposync/runreposync.sh index 9ce5f65d98b2313b146e185f63fb16d034c6bd90..fb52d63a76d3dc5ae74c2e2262f52ff1cb1c7f44 100755 --- a/reposync/runreposync.sh +++ b/reposync/runreposync.sh @@ -55,9 +55,9 @@ trap 'rm -f "$LOCKFILE"; exit $?' INT TERM EXIT if [[ $RUN_REPOSYNC -eq 1 ]]; then # Record what's already there first - PRECOUNT=`/usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 | /usr/bin/wc -l` - PRELIST=`/usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 -exec /bin/basename {} \;` - PRESIZE=`/usr/bin/du -bc Packages/*rpm *rpm source/SRPMS/*rpm source/SRPMS/Packages/*rpm 2>/dev/null | /usr/bin/tail -1 | /bin/sed "s/\stotal//g"` + /usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 -printf '%f %s\n' > /tmp/prelist + PRECOUNT=`wc -l /tmp/prelist | cut -d' ' -f1` + PRESIZE=`awk '{print $2}' /tmp/prelist | paste -sd+ | bc` grep 'baseurl=' /etc/yum.repos.d/sync.repo | grep -q 'aarch64' if [ $? -eq 0 ]; then @@ -95,12 +95,13 @@ EOF /usr/bin/find ${REPOPATH} -type f -size 0b -name "*.rpm" -exec rm -v {} \; # Now let's look at the new stuff - POSTCOUNT=`/usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 | /usr/bin/wc -l` - POSTLIST=`/usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 -exec /bin/basename {} \;` + /usr/bin/find ${REPOPATH} -type f -name "*.rpm" ! -size 0 -printf '%f %s\n' > /tmp/postlist + POSTCOUNT=`wc -l /tmp/postlist | cut -d' ' -f1` + # cdn.redhat.com delivers us some rpms with junk attached at the end ... ? # these are 'useable' but since the size changes, metadata must be regenerated to # take it into account. - POSTSIZE=`/usr/bin/du -bc Packages/*rpm *rpm source/SRPMS/*rpm source/SRPMS/Packages/*rpm 2>/dev/null | /usr/bin/tail -1 | /bin/sed "s/\stotal//g"` + POSTSIZE=`awk '{print $2}' /tmp/postlist | paste -sd+ | bc` # Sync GPG key from repo config file. Put it on repo root path grep -q 'gpgkey=' /etc/yum.repos.d/sync.repo @@ -118,7 +119,7 @@ EOF fi if [[ ($PRECOUNT -ne $POSTCOUNT) || ($PRESIZE -ne $POSTSIZE) ]]; then - CHANGELIST=`/usr/bin/diff --changed-group-format='%>' --unchanged-group-format='' <(echo "$PRELIST") <(echo "$POSTLIST")` + CHANGELIST=`/usr/bin/diff --changed-group-format='%>' --unchanged-group-format='' <(awk '{print $1}' /tmp/prelist) <(awk '{print $1}' /tmp/postlist)` # Run createrepo if [[ $RUN_CREATEREPO -eq 1 ]]; then