enclosed is a script that prechecks a list of RPM files at the Mirror Server,
and your local hard drive.
it will rename local rpms to the name of the same (updated) file on the mirror
server.
When it finds a file that it thinks has changed on the mirror server, it
checks with you whether to rename that file locally.
ie:
zlib-devel-1.1.3-11mdk.i586.rpm
to zlib-devel-1.1.3-13mdk.i586.rpm
REASONING:
rsync uses a checksum to see if parts of a file are common between existing
files and remote files.
This only works when the file name is the same on both sides of the link.
What this script does, is ensures that if a file has only changed slightly,
you do not download the whole thing all over again (due to the minor name
change)
WARRANTY: etc
This script works for me.
It *is* a quick and nasty hack that I threw together.
It does contain security holes if you run it on a Multi User system.
It may/may not work for you.
I will take no responsibility if it eats your cat, munges files, starts WWIII,
or otherwise does anything expected or unexpected.
LICENCE:
GPL 2.0
DO NOT complain to me if you have problems.
SCRIPT:
#!/bin/bash
#
# prersync: pre check an rsync tree to try to save rsync d/l
# author: Allen Bolderoff <[EMAIL PROTECTED]>
#edit these to suit your preference.
REMOTE_ROOT="ftp.sunet.se::Mandrake-devel/7.2beta/i586"
LOCAL_ROOT="/mnt/disk/Mandrake/7.2beta/i586"
REMOTE_LIST="/tmp/remote"
LOCAL_LIST="/tmp/local"
clear
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++"
echo "Rsync Minimiser"
echo
echo "THIS Script is released under GPL 2.0
echo "it comes with no warranty or any other claim to work or otherwise do
anything"
echo "that you want/think it might do."
echo
echo "Make sure you edit the variables at the top before you start"
echo
echo "Getting Local RPM List"
ls -1 $LOCAL_ROOT/Mandrake/RPMS/ > $LOCAL_LIST
echo
echo "About to download remote RPM LIST"
mkdir /tmp/test/
rsync -anv ftp.sunet.se::Mandrake-devel/7.2beta/i586/Mandrake/RPMS/ /tmp/test >
$REMOTE_LIST
for i in `cat $LOCAL_ROOT/Mandrake/base/rpmslist`
do
LOC=`grep "^$i" $LOCAL_LIST | head -n1`
REM=`grep "^$i" $REMOTE_LIST | head -n1`
clear
echo
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++"
echo "$i"
if [ "$REM" != "" ]; then
if [ "$LOC" != "" ] ; then
if [ "$REM" != "$LOC" ]; then
echo "NEED TO MOVE"
echo " $LOC"
echo "to $REM"
echo "DO YOU WANT TO DO THIS? y/n"
read a
if [ "$a" = "y" ]; then
mv $LOCAL_ROOT/Mandrake/RPMS/$LOC
$LOCAL_ROOT/Mandrake/RPMS/$REM
else
echo "Not Moved"
fi
fi
fi
fi
done