View previous topic :: View next topic |
Author |
Message |
zyta2k n00b
Joined: 29 Apr 2002 Posts: 7 Location: Switzerland
|
Posted: Thu May 02, 2002 12:48 pm Post subject: helper-script for host behind firewall (instead of blocked r |
|
|
Hi there,
wrote a small script because I've a problem using rsync behind a firewall.
Do you have the same problem... then this is for you
Code: |
#!/bin/bash
MAXDAYS=5
cd /usr
echo -n "searching snapshot..."
for ((BACKDAYS=0; BACKDAYS<=MAXDAYS; BACKDAYS++))
do
DATESTR="now -"`expr $BACKDAYS \* 24`" hours"
DAY=`date -d "$DATESTR" +%Y%m%d`
PORTAGEZIP="portage-$DAY.tar.bz2"
RESULT=`wget --spider http://www.ibiblio.org/gentoo/snapshots/$PORTAGEZIP 2>&1 | grep "^200 OK"`
if [[ $RESULT == "200 OK" ]] ; then
break
fi
done
echo -e "\tfound at today - $BACKDAYS day(s) !"
echo "downloading snapshot..."
wget "http://www.ibiblio.org/gentoo/snapshots/$PORTAGEZIP"
if [[ $1 == "clean" ]] ; then
echo -n "removing old tree"
rm -rf portage
fi
echo -n "unzipping snapshot..."
tar xvfj $PORTAGEZIP > /dev/null 2>&1
echo -e "\tdone"
echo -n "removing tarball..."
rm $PORTAGEZIP
echo -e "\tdone"
cd -
|
have fun
Comments welcome |
|
Back to top |
|
|
DArtagnan l33t
Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Wed May 15, 2002 2:34 pm Post subject: script |
|
|
Hi thanks for help
Can you explaind these lines because i did't understand where do u untar the package and what is 'cd -'?
Quote: | echo -n "unzipping snapshot..."
tar xvfj $PORTAGEZIP > /dev/null 2>&1
echo -e "\tdone"
echo -n "removing tarball..."
rm $PORTAGEZIP
echo -e "\tdone"
cd - |
Many thanks _________________ All for one and one for All
--
MACPRO machine... |
|
Back to top |
|
|
zyta2k n00b
Joined: 29 Apr 2002 Posts: 7 Location: Switzerland
|
Posted: Thu May 16, 2002 11:23 am Post subject: script |
|
|
Hi...
first chanhing into dir /usr
then I download the latest snapshot on ibiblio.org to the above dir (/usr) using wget
Code: | wget "http://www.ibiblio.org/gentoo/snapshots/$PORTAGEZIP" |
if you run update_portage with the argument "clean", the whole portage tree will be deleted before unpacking the new one...
this results in a clean portage-tree in /usr/portage
Code: |
if [[ $1 == "clean" ]] ; then
echo -n "removing old tree"
rm -rf portage
fi
|
then I unzip my previously downloaded using the command
Code: | tar xvfj $PORTAGEZIP > /dev/null 2>&1 |
now i cleanup the downloaded tarball /usr/snapshot-xxyyzz.ta.bz2 because nothing should reside in /usr (it's a little hack I know ) but it works...
this snipplet changes back to the origin-dir (where the script is startet, before the 'cd /usr')
It's tested under bash on a i686.
Hope it works
Greetz from Switzerland |
|
Back to top |
|
|
DArtagnan l33t
Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Thu May 16, 2002 12:29 pm Post subject: emerge rsync |
|
|
First of all thanks.
Do you want to say that this script will help instead "emerge rsync" ? _________________ All for one and one for All
--
MACPRO machine... |
|
Back to top |
|
|
zyta2k n00b
Joined: 29 Apr 2002 Posts: 7 Location: Switzerland
|
Posted: Thu May 16, 2002 3:26 pm Post subject: Re: emerge rsync |
|
|
pacman wrote: |
Do you want to say that this script will help instead "emerge rsync" ? |
Yes... from the Gentoo-FAQ:
Quote: |
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 only followed the instructions
But my script is a little bit more powerful than the manual wget way *g* |
|
Back to top |
|
|
step Apprentice
Joined: 16 May 2002 Posts: 198
|
|
Back to top |
|
|
DArtagnan l33t
Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Fri Jun 28, 2002 9:04 am Post subject: |
|
|
in make.conf or in this script? _________________ All for one and one for All
--
MACPRO machine... |
|
Back to top |
|
|
mksoft l33t
Joined: 28 May 2002 Posts: 844
|
Posted: Fri Jun 28, 2002 9:23 am Post subject: |
|
|
One problem though. From the code:
Code: | echo -e "\tfound at today - $BACKDAYS day(s) !"
echo "downloading snapshot..."
wget "http://www.ibiblio.org/gentoo/snapshots/$PORTAGEZIP"
if [[ $1 == "clean" ]] ; then
echo -n "removing old tree"
rm -rf portage
fi |
If somehow wget in the code snippet fails (timeout during download, lost connection etc..) the portage tree will be removed, without no new file available.
The return value from wget should be checked, and continue only if OK. _________________ There's someone in my head but it's not me - Pink Floyd |
|
Back to top |
|
|
DArtagnan l33t
Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Fri Jun 28, 2002 10:36 am Post subject: |
|
|
Mr. debug _________________ All for one and one for All
--
MACPRO machine... |
|
Back to top |
|
|
rizzo Retired Dev
Joined: 30 Apr 2002 Posts: 1067 Location: Manitowoc, WI, USA
|
Posted: Fri Sep 27, 2002 1:18 pm Post subject: |
|
|
Both of these URLs work and point to apparently the same directory on the webserver anyway. |
|
Back to top |
|
|
|