#!/bin/bash # This script can be run manually or by cron to service the urpmi-proxy cache. Functions: # 1) make downloaded .noarch packages for 32 bit available for 64 bit arc and vice versa (i.e large game data) # 2) remove media_info files from updating medias # 3) call cache-rinse.py to delete old rpms (thanks Luca Olivetti) # /Morgan Leijström # Check parameters it use, i.e mageia versions (first "for ver in..." line below. if [ "$(whoami)" != 'root' ]; then echo "You must run $0 as root user." exit 1; fi # define the root of urpmi-proxy cache base=/var/cache/urpmi-proxy/distrib # Make any *.noarch downloaded for one architecture be available in the other architectures repo too: # Cross link *.noarch between architecures (hard links use almost no extra space for duplicates) # It will fail on non existant directory, and on existing target file ( no problem), and do next for ver in 4 5 cauldron ; do # excluded: $ver/debug for typ in core nonfree tainted ; do # excluded: *_debug & *_testing for relup in release updates ; do # (updates in cauldron is normally empty, but go on...) # Cross link: ln $base/$ver/i586/media/$typ/$relup/*noarch.rpm -t $base/$ver/x86_64/media/$typ/$relup/ ln $base/$ver/x86_64/media/$typ/$relup/*noarch.rpm -t $base/$ver/i586/media/$typ/$relup/ # In media_info of all update repos and all cauldron there will accumulate old files # (cache-rinse.py do not handle these ); # We simply empty these media_info folders if [ $ver = 'cauldron' -o $relup = 'updates' ] ; then rm -f $base/$ver/i586/media/$typ/$relup/media_info/* rm -f $base/$ver/x86_64/media/$typ/$relup/media_info/* fi done done done # Note: in any debug or testing repo we neither duplicate .noarch files nor clean media_info # Remove old rpm, keep the newest version of each package # Note: cache-rinse.py must exist in and be run from the cache tree root! cd $base/ $base/cache-rinse.py --delete