Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 57887 | Differences between
and this patch

Collapse All | Expand All

(-)emerge-webrsync (-13 / +27 lines)
Lines 7-20 Link Here
7
7
8
GENTOO_MIRRORS="$(/usr/lib/portage/bin/portageq gentoo_mirrors)"
8
GENTOO_MIRRORS="$(/usr/lib/portage/bin/portageq gentoo_mirrors)"
9
PORTDIR="$(/usr/lib/portage/bin/portageq portdir)"
9
PORTDIR="$(/usr/lib/portage/bin/portageq portdir)"
10
syncpath="/var/tmp/emerge-webrsync"
10
FETCHCOMMAND="$(/usr/lib/portage/bin/portageq envvar FETCHCOMMAND)"
11
USERLAND="$(/usr/lib/portage/bin/portageq envvar USERLAND)"
12
DISTDIR="/var/tmp/emerge-webrsync"
11
13
12
if [ ! -d $syncpath ] ; then
14
if [ ! -d $DISTDIR ] ; then
13
	mkdir -p $syncpath
15
	mkdir -p $DISTDIR
14
fi
16
fi
15
17
16
cd $syncpath
17
18
found=0
18
found=0
19
attempts=0
19
attempts=0
20
download=1
20
download=1
Lines 21-27 Link Here
21
if [ "$1" == "-v" ] ; then
22
if [ "$1" == "-v" ] ; then
22
	wgetops=
23
	wgetops=
23
else	
24
else	
25
	#this sucks.  probably better to do 1> /dev/null
26
	#that said, waiting on the refactoring.
27
	if [ "${FETCHCOMMAND/wget}" == "${FETCHCOMMAND}" ]; then
24
	wgetops=-q
28
	wgetops=-q
29
	elif [ "${FETCHCOMMAND/curl}" == "${FETCHCOMMAND}" ]; then
30
		wgetops=-s
31
	fi
25
fi
32
fi
26
33
27
if [ "$1" == "-n" ] ; then
34
if [ "$1" == "-n" ] ; then
Lines 33-39 Link Here
33
	tar jxf $file
40
	tar jxf $file
34
	rm -f $file
41
	rm -f $file
35
	# Make sure user and group file ownership is root
42
	# Make sure user and group file ownership is root
36
	chown -R root:root portage
43
	chown -R 0:0 portage
37
	cd portage
44
	cd portage
38
	rsync -av --progress --stats --delete --delete-after \
45
	rsync -av --progress --stats --delete --delete-after \
39
	--exclude='distfiles/*' --exclude='packages/*' . ${PORTDIR%%/}
46
	--exclude='distfiles/*' --exclude='packages/*' . ${PORTDIR%%/}
Lines 45-66 Link Here
45
52
46
while (( $attempts <  40 )) ; do
53
while (( $attempts <  40 )) ; do
47
54
48
	day=`date -d "-$attempts day" +"%d"`
55
	#this too, sucks.  it works in the interim though.
49
	month=`date -d "-$attempts day" +"%m"`
56
	if [ "$USERLAND" == "BSD" ] ; then
50
	year=`date -d "-$attempts day" +"%Y"`
57
		daysbefore=$(expr $(date +"%s") - 86400 \* $attempts)
58
		day=$(date -r $daysbefore +"%d")
59
		month=$(date -r $daysbefore +"%m")
60
		year=$(date -r $daysbefore +"%Y")
61
	else
62
		day=$(date -d "-$attempts day" +"%d")
63
		month=$(date -d "-$attempts day" +"%m")
64
		year=$(date -d "-$attempts day" +"%Y")
65
	fi
51
66
52
	file="portage-${year}${month}${day}.tar.bz2"
67
	FILE="portage-${year}${month}${day}.tar.bz2"
53
68
54
	if [ -f $file ] && [ $download == 0 ] ; then
69
	if [ -f $FILE ] && [ $download == 0 ] ; then
55
		sync_local
70
		sync_local
56
		exit 0
71
		exit 0
57
	fi
72
	fi
58
73
59
	for i in $GENTOO_MIRRORS ; do 
74
	for i in $GENTOO_MIRRORS ; do 
60
		url="${i}/snapshots/$file"
75
		URI="${i}/snapshots/$FILE"
61
		rm -f $file
76
		rm -f $file
62
		
77
		
63
		if (wget $wgetops $url) && [ -s $file ] ; then
78
		if (eval "$FETCHCOMMAND $wgetops") && [ -s $FILE ] ; then
64
			sync_local
79
			sync_local
65
			echo
80
			echo
66
			echo " *** Completed websync, please now perform a normal rsync if possible."
81
			echo " *** Completed websync, please now perform a normal rsync if possible."

Return to bug 57887