Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
script to duplicate "emerge rsync" using wget?
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
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Fri Apr 19, 2002 12:19 pm    Post subject: script to duplicate "emerge rsync" using wget? Reply with quote

For those of us who are dealing with restrictive firewalls, has anyone written a script that will do the same as "emerge rsync", except using wget?

I realize it's not all that hard to write, but it's Friday and I'm just being extra lazy today. If someone else has already done the work, great!
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
Fragadelic
n00b
n00b


Joined: 18 Apr 2002
Posts: 26

PostPosted: Fri Apr 19, 2002 2:35 pm    Post subject: Reply with quote

Check the link below for the Gentoo FAQ's.

Apparently emerge does use wget.

http://www.gentoo.org/doc/faq.html

Quote from above link:
How do I use emerge from behind a firewall?

Edit the PROXY settings in /etc/make.conf. If that doesn't work, edit /etc/wget/wgetrc and edit http_proxy and ftp_proxy appropriately.
Back to top
View user's profile Send private message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Fri Apr 19, 2002 2:49 pm    Post subject: Reply with quote

Fragadelic wrote:
Apparently emerge does use wget.


It can use wget to retrieve packages (that's what I'm using now), but it doesn't seem to work for syncing the portage tree, which is what I'm looking for.

Currently, I'm using the following (manual) method mentioned in the FAQ:

Quote:
What if rsync doesn't work for me?

If you're behind a firewall that doesn't permit rsync traffic, then you can instead download the daily /usr/portage snapshot from http://cvs.gentoo.org/snapshots. Just unpack the tarball (using tar xvjf portage-foo.tbz2) in the /usr directory.


I'm just looking for a script that automates this so I can schedule it via crontab.
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
Fragadelic
n00b
n00b


Joined: 18 Apr 2002
Posts: 26

PostPosted: Fri Apr 19, 2002 3:37 pm    Post subject: Reply with quote

You could do it like this:

Create a file called 'portage-tree-update'

Remember to 'chmod 700 portage-tree-update' after you save the file.

#!/bin/ bash

cd /tmp
wget http://cvs.gentoo.org/snapshots/portage*.bz2
cd /usr
tar xvjf /tmp/portage*.bz2
rm /tmp/portage*.bz2



This is just a very simple example of what you can do. You can try to use it and see if it works for you. The only issue might be if there are more than 1 portage files there, it will bring them all in.

I don't have access to my system right now so I can't make it more specific cause you can make it look for the exact filename by date. Let me have a look at it later today and I will post another example for you.
Back to top
View user's profile Send private message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Fri Apr 19, 2002 4:49 pm    Post subject: Reply with quote

Thanks for the reply. I ended up getting over my laziness and writing my own. It ended up being embarassingly easy:
Code:

#!/bin/bash

today=$(date +%d)
yesterday=$(expr $today - 1)
month=$(date +%m)
year=$(date +%Y)

wget http://www.ibiblio.org/gentoo/snapshots/portage-$year$month$yesterday.tar.bz2 -O /usr/portage_update.tar.bz2
tar --directory /usr -xvjf /usr/portage_update.tar.bz2


beware line wrap above.

hope this helps someone else.
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
rizzo
Retired Dev
Retired Dev


Joined: 30 Apr 2002
Posts: 1067
Location: Manitowoc, WI, USA

PostPosted: Fri May 03, 2002 3:36 pm    Post subject: Reply with quote

Your script won't have leading 0's on the day.
Code:

--10:35:12--  http://www.ibiblio.org/gentoo/snapshots/portage-2002052.tar.bz2
           => `/usr/portage_update.tar.bz2'
Proxy request sent, awaiting response... 404 Not Found
10:35:12 ERROR 404: Not Found.


Perhaps a sprintf or something is needed. I'm not a bash wizard.
Back to top
View user's profile Send private message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Fri May 03, 2002 3:42 pm    Post subject: Reply with quote

rizzo wrote:
Your script won't have leading 0's on the day.


Yeah -- it was a nasty script anyway. Here's a much better one. (thanks to zyta2k for writing it)

--kurt
_________________
The problem with political jokes is that they get elected
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