View previous topic :: View next topic |
Author |
Message |
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Fri Apr 19, 2002 12:19 pm Post subject: script to duplicate "emerge rsync" using wget? |
|
|
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 |
|
|
Fragadelic n00b
Joined: 18 Apr 2002 Posts: 26
|
Posted: Fri Apr 19, 2002 2:35 pm Post subject: |
|
|
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 |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Fri Apr 19, 2002 2:49 pm Post subject: |
|
|
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 |
|
|
Fragadelic n00b
Joined: 18 Apr 2002 Posts: 26
|
Posted: Fri Apr 19, 2002 3:37 pm Post subject: |
|
|
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 |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Fri Apr 19, 2002 4:49 pm Post subject: |
|
|
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 |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Fri May 03, 2002 3:36 pm Post subject: |
|
|
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 |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Fri May 03, 2002 3:42 pm Post subject: |
|
|
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 |
|
|
|