Re: [Cooker] SCRIPT: prersync.sh - For people on slow connections
Allen Bolderoff wrote: > what we should do, is to have it create the files and tmp dirs within a > private space somewhere. Use $HOME/tmp/? with a lock file if that's necessary ... -- Regards, Ron. [in AU, busy 625-line-PAL-TV-watching the Olympics]
Re: [Cooker] SCRIPT: prersync.sh - For people on slow connections
[EMAIL PROTECTED] said: > Allen Bolderoff wrote: > As stated, it does have many *race* security issues. as well as the > fact that > it misses some combinations (that is why it asks before moving each > file.) > It also needs a: > rmdir /tmp/test/ > at the end if you want to run it more than once . *actually* that is one of the race conditions. what we should do, is to have it create the files and tmp dirs within a private space somewhere. not bothered myself. Allen -- +++ Allen Bolderoff <[EMAIL PROTECTED]> CTPC - Caffeine - get it here: http://www.coffee-tea-pots-cups.com/ +++ GPG fingerprint = CBB0 8626 702C 3D01 B5AD A54A DC2C 93B7 3E4B 6472 +++
Re: [Cooker] SCRIPT: prersync.sh - For people on slow connections
Allen Bolderoff wrote: > As stated, it does have many *race* security issues. as well as the fact that > it misses some combinations (that is why it asks before moving each file.) It also needs a: rmdir /tmp/test/ at the end if you want to run it more than once . -- Regards, Ron. [in AU, busy 625-line-PAL-TV-watching the Olympics]
Re: [Cooker] SCRIPT: prersync.sh - For people on slow connections
[EMAIL PROTECTED] said: > it seems to work well, and I intend to add a call to it early in my > published rsync en-GB only download script. As stated, it does have many *race* security issues. as well as the fact that it misses some combinations (that is why it asks before moving each file.) other than that, on a single user box, it should work fine. -- +++ Allen Bolderoff <[EMAIL PROTECTED]> CTPC - Caffeine - get it here: http://www.coffee-tea-pots-cups.com/ +++ GPG fingerprint = CBB0 8626 702C 3D01 B5AD A54A DC2C 93B7 3E4B 6472 +++
Re: [Cooker] SCRIPT: prersync.sh - For people on slow connections
Allen, This is excellent thinking and excellent work! Very good! That is, once you have changed the line: echo "THIS Script is released under GPL 2.0 to the line: echo "THIS Script is released under GPL 2.0" and removed the word wrapping, it seems to work well, and I intend to add a call to it early in my published rsync en-GB only download script. Well done! Allen Bolderoff wrote: > > 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 -- Regards, Ron. [in AU, busy 625-line-PAL-TV-watching the Olympics]
Re: [Cooker] SCRIPT: prersync.sh - For people on slow connections
Make sure you run this BEFORE running your rsync job. it *will* save you heaps of time. -- +++ Allen Bolderoff <[EMAIL PROTECTED]> CTPC - Caffeine - get it here: http://www.coffee-tea-pots-cups.com/ +++ GPG fingerprint = CBB0 8626 702C 3D01 B5AD A54A DC2C 93B7 3E4B 6472 +++
[Cooker] SCRIPT: prersync.sh - For people on slow connections
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