On Mar 17 05:16:32, J.C. Roberts wrote: > On Wed, 17 Mar 2010 11:34:16 +0100 Jan Stary <h...@stare.cz> wrote: > > > http://marc.info/?l=openbsd-misc&m=126678113118214&w=2 > > > > Has the format of > > ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/i386/index.txt > > changed again? It seems to be 'ls -l' now. > > > > Hi Jan, > > I think this is the second time I've seen you mention the format of the > index.txt file... so it seems you're "mistakenly" trying to parse > index.txt to get the file/path names of the stuff you need to download. > (pardon me if my mind reading skills are slightly off) >
Indeed, that's what I've been using index.txt for. (Sorry for not enough mind writing.) Isn't that why index.txt is there? > #!/bin/ksh > > ftp_host="ftp.openbsd.org" > basepath="pub/OpenBSD/snapshots" > arch=`uname -m` > > ftp -i -n <<EOF >>ftp.log > open $ftp_host > user anonymous none@ > nlist $basepath/$arch ftp.files > EOF > > # exclude floppy*.fs and *.iso > for FNAME in `grep -v -e "\.iso" -e "\.fs" ftp.files | > sed -e "s:$basepath/$arch/::"`; do > if [[ -z $FLIST ]]; then > FLIST="$FNAME"; > else > FLIST="$FLIST FNAME" > fi > done > ----------------------------------------------------------- > NOTE the "for ..." is wrapped, > The result is $FLIST contains just a list of all the file names of the > stuff on the ftp server in the given directory excluding the *.fs and > *.iso files. Very similar to my script here, except I get my list from index.txt ---- #!/bin/sh error() { echo $@ >&2 } fatal() { error $@ exit 1 } usage() { error usage: ${0##*/} release destination [master] error as in: ${0##*/} '`uname -r` ~/WWW ftp://openbsd.ftp.fu-berlin.de' error as in: ${0##*/} snapshots /install ftp://ftp.openbsd.org error as in: ${0##*/} snapshots /install exit 1 } [ $# -ge 2 ] || usage DEST=$2/pub/OpenBSD/$1/`uname -m` mkdir -p $DEST || fatal cannot create $DEST cd $DEST || fatal cannot cd to $DEST SITE=${3:-ftp://ftp.openbsd.org} SITE=$SITE/pub/OpenBSD/$1/`uname -m` ftp -a -V $SITE/index.txt || fatal cannot fetch index.txt cat index.txt | sed "s,^,$SITE/," | xargs ftp -a -k30 -V cksum -c SHA256 ---- > The real magic in the above is in the "nlist" command of ftp, and you > don't necessarily need to do it in a shell script. perl would work > equally well. (Aaargh, I use a shell script whenever I don't necessarily need to use perl, thank you.) > If my mind reading skills are off, and you're trying to check the time > stamp of files on the ftp server, then check out the ftp "modtime" > command, and point it at the SHA256 file (that "should" be there). > > In other words, the format of "index.txt" should not matter since there > are better ways to get the information you want. It's been a long time I have read ftp(1), and apparently I forgot about 'nlist' - thanks. Anyway, what really is the purpose of index.txt being there then? To tell the times and sizes? Jan