1. sync everything except for repomd.xml
2. then sync repomd.xml files only, and invalidate caches
3. gently wait a bit to give current downloads a chance
4. delete outdated RPMs and metadata, shouldn't be needed
Also make the sleep/cache configurable.
Doing this has risk that '*' expands to directories:
$> x='echo *'
$> $x
bin boot dev etc home
So it is better to use bash array (we have bash shebang anyways):
$> x=( echo '*' )
$> "${x[@]}"
*
Also de-duplicate few things so it is easier to concentrate on the code.
In order to make sure the s3 mirror always is consistent, split out the commands
to make it sync without repodata and delete, then do another run with those, then finally
invalidate all the repodata/* files.
Some of the cron jobs are adjusted to allow the repodata invalidation.
Signed-off-by: Kevin Fenzi <kevin@scrye.com>