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.orig (-8 / +28 lines)
Lines 7-12 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
USERLAND="$(/usr/lib/portage/bin/portageq envvar USERLAND)"
10
syncpath="/var/tmp/emerge-webrsync"
11
syncpath="/var/tmp/emerge-webrsync"
11
12
12
if [ ! -d $syncpath ] ; then
13
if [ ! -d $syncpath ] ; then
Lines 18-27 Link Here
18
found=0
19
found=0
19
attempts=0
20
attempts=0
20
download=1
21
download=1
22
if which wget >/dev/null 2>&1 ; then
23
	fetchcommand="wget"
24
else
25
	fetchcommand="curl -O"
26
fi
27
21
if [ "$1" == "-v" ] ; then
28
if [ "$1" == "-v" ] ; then
22
	wgetops=
29
	opts=
23
else	
30
else	
24
	wgetops=-q
31
	case $fetchcommand in
32
		wget)	opts=-q ;;
33
		curl)	opts=-s ;;
34
		*)	opts= ;;
35
	esac
25
fi
36
fi
26
37
27
if [ "$1" == "-n" ] ; then
38
if [ "$1" == "-n" ] ; then
Lines 33-39 Link Here
33
	tar jxf $file
44
	tar jxf $file
34
	rm -f $file
45
	rm -f $file
35
	# Make sure user and group file ownership is root
46
	# Make sure user and group file ownership is root
36
	chown -R root:root portage
47
	# Specify with numeric expression because of Mac OS X
48
	chown -R 0:0 portage
37
	cd portage
49
	cd portage
38
	rsync -av --progress --stats --delete --delete-after \
50
	rsync -av --progress --stats --delete --delete-after \
39
	--exclude='distfiles/*' --exclude='packages/*' . ${PORTDIR%%/}
51
	--exclude='distfiles/*' --exclude='packages/*' . ${PORTDIR%%/}
Lines 45-57 Link Here
45
57
46
while (( $attempts <  40 )) ; do
58
while (( $attempts <  40 )) ; do
47
59
48
	day=`date -d "-$attempts day" +"%d"`
60
	if [ "$USERLAND" == "BSD" ] ; then
49
	month=`date -d "-$attempts day" +"%m"`
61
		daysbefore=$(expr $(date +"%s") - 86400 \* $attempts)
50
	year=`date -d "-$attempts day" +"%Y"`
62
63
		day=$(date -r $daysbefore +"%d")
64
		month=$(date -r $daysbefore +"%m")
65
		year=$(date -r $daysbefore +"%Y")
66
	else
67
		day=$(date -d "-$attempts day" +"%d")
68
		month=$(date -d "-$attempts day" +"%m")
69
		year=$(date -d "-$attempts day" +"%Y")
70
	fi
51
71
52
	file="portage-${year}${month}${day}.tar.bz2"
72
	file="portage-${year}${month}${day}.tar.bz2"
53
73
54
	if [ -f $file ] && [ $download == 0 ] ; then
74
	if [ -f "$file" ] && [ "$download" == 0 ] ; then
55
		sync_local
75
		sync_local
56
		exit 0
76
		exit 0
57
	fi
77
	fi
Lines 60-66 Link Here
60
		url="${i}/snapshots/$file"
80
		url="${i}/snapshots/$file"
61
		rm -f $file
81
		rm -f $file
62
		
82
		
63
		if (wget $wgetops $url) && [ -s $file ] ; then
83
		if ($fetchcommand $opts $url) && [ -s $file ] ; then
64
			sync_local
84
			sync_local
65
			echo
85
			echo
66
			echo " *** Completed websync, please now perform a normal rsync if possible."
86
			echo " *** Completed websync, please now perform a normal rsync if possible."

Return to bug 57887