friction Tux's lil' helper
Joined: 16 Sep 2002 Posts: 109
|
Posted: Sun Mar 02, 2003 1:28 pm Post subject: NFS READONLY share of /usr/portage |
|
|
Another computer on my local LAN is updated far more often than my own machine, but isn't always on. Wanting a way to download from the nfs share as a mirror before trying the net, I found that wget, lukemftp, and prozilla didn't like downloading from a local directory.
It seemed silly to emerge another download tool just for this purpose, so I wrote a little script called cpwget, which will look at the prefix of the URL (http://, file://, ftp://), and either call cp or wget (hence cpwget) depending. Then I added the NFS directory prefixed with file:// to my gentoo_mirrors and all was good.
There is perhaps a much better way of doing this, if so feel free to share.
Code: |
#!/bin/bash
URI=$1
DEST=$2
if [ -z $DEST ]
then
echo "cpwget: missing destination file"
echo "Usage: cpwget url directory"
exit 1
fi
if [ ${URI:0:5} == "https" ]
then
echo "wget"
else
if [ ${URI:0:5} == "https" ] || [ ${URI:0:4} == "http" ] || [ ${URI:0:3} == "ftp" ]
then
/usr/bin/wget -t 5 --passive-ftp $URI -P $DEST
else
if [ ${URI:0:4} == "file" ]
then
cp ${URI:5} $DEST
else
echo "cpwget: not a supported protocol"
echo "Usage: cpwget url directory"
exit 1
fi
fi
fi
|
|
|