Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NFS READONLY share of /usr/portage
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
friction
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2002
Posts: 109

PostPosted: Sun Mar 02, 2003 1:28 pm    Post subject: NFS READONLY share of /usr/portage Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum