Re: tech proposal to make manoj somewhat happy.
Jason Gunthorpe <jgg@gpu.srv.ualberta.ca> wrote:
> The APT http (and ftp) clients are probably ideally suited to this. They
> are about 30-40k each.
For what it's worth, nc is about 16k, and that little script I included a
few messages back was less than 512 bytes. It needs something to parse
the ip address and port, but the parsing could be handled by /bin/sh
and sed -- all that's really needed is some way of multiplying by 256
and adding.
And, nc could be trimmed down a fair bit, I think.
Hmm... [read, read, read, test, test]. Turns out that /bin/sh on the
rescue disk knows how to do math. Here's a variation on that ftp script
which should work on the rescue disk (or would if something like nc
is available). Since all it needs to do is retrieve a single file,
perhaps from a dedicated server, probably even this much complexity
isn't needed:
#!/bin/sh
# trivial ftp client -- requested file appears on stdout
if [ $# != 3 ]; then
>&2 echo "Usage: $0 host dir file"
exit 1
fi
retrieve() {
while read line; do
>&2 echo "$line";
case "$line" in [1-5][0-9][0-9]\ *) echo "$line";; esac
done | (
read connect
read user
read pass
read cwd
read pasv
echo $pasv | sed 's/.*[^0-9]\([0-9]*,[0-9]*,[0-9]*,[0-9]*,[0-9]*,[0-9]*\).*/\1/' | (
IFS=,
read a b c d e f
eval nc $a.$b.$c.$d $(($e * 256 + $f)) </dev/null
)
)
}
nc $1 21 <<END | retrieve
USER ftp
PASS `whoami`@
CWD $2
PASV
RETR $3
QUIT
END
--
Raul
--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: