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

Collapse All | Expand All

(-)emerge-webrsync (-1 / +39 lines)
Lines 5-10 Link Here
5
# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
5
# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
6
# Rewritten from the old, Perl-based emerge-webrsync script
6
# Rewritten from the old, Perl-based emerge-webrsync script
7
7
8
#
9
# gpg key import
10
# KEY_ID=0x7DDAD20D
11
# gpg --homedir /etc/portage/gnupg --keyserver subkeys.pgp.net --recv-keys $KEY_ID
12
# gpg --homedir /etc/portage/gnupg --edit-key $KEY_ID trust
13
8
# If PORTAGE_NICENESS is overriden via the env then it will
14
# If PORTAGE_NICENESS is overriden via the env then it will
9
# still pass through the portageq call and override properly.
15
# still pass through the portageq call and override properly.
10
PORTAGE_NICENESS="$(/usr/lib/portage/bin/portageq envvar PORTAGE_NICENESS)"
16
PORTAGE_NICENESS="$(/usr/lib/portage/bin/portageq envvar PORTAGE_NICENESS)"
Lines 21-26 USERLAND="$(/usr/lib/portage/bin/portage Link Here
21
DISTDIR="$(/usr/lib/portage/bin/portageq envvar PORTAGE_TMPDIR)/emerge-webrsync"
27
DISTDIR="$(/usr/lib/portage/bin/portageq envvar PORTAGE_TMPDIR)/emerge-webrsync"
22
PORTAGE_INST_UID="$(/usr/lib/portage/bin/portageq envvar PORTAGE_INST_UID)"
28
PORTAGE_INST_UID="$(/usr/lib/portage/bin/portageq envvar PORTAGE_INST_UID)"
23
PORTAGE_INST_GID="$(/usr/lib/portage/bin/portageq envvar PORTAGE_INST_GID)"
29
PORTAGE_INST_GID="$(/usr/lib/portage/bin/portageq envvar PORTAGE_INST_GID)"
30
WEBSYNC_VERIFY_SIGNATURE="$(/usr/lib/portage/bin/portageq envvar WEBSYNC_VERIFY_SIGNATURE)"
31
PORTAGE_GPG_HOME="$(/usr/lib/portage/bin/portageq envvar PORTAGE_GPG_HOME)"
32
33
if [ -z "$WEBSYNC_VERIFY_SIGNATURE" ]; then
34
	WEBSYNC_VERIFY_SIGNATURE=0
35
fi
36
24
if [ ! -d $DISTDIR ] ; then
37
if [ ! -d $DISTDIR ] ; then
25
	mkdir -p $DISTDIR
38
	mkdir -p $DISTDIR
26
fi
39
fi
Lines 50-55 else Link Here
50
	md5_com='true'
63
	md5_com='true'
51
fi
64
fi
52
65
66
if [ $WEBSYNC_VERIFY_SIGNATURE != 0 ]; then
67
	if type -p gpg > /dev/null; then
68
		gpg_com='gpg --homedir "${PORTAGE_GPG_HOME}" --verify ${FILE}.gpgsig ${FILE}'
69
	else
70
		echo "Cannot find gpg"
71
		exit 1
72
	fi
73
else
74
	gpg_com='true'
75
fi
76
53
sync_local() {
77
sync_local() {
54
	echo Syncing local tree...
78
	echo Syncing local tree...
55
	if type -p tarsync &> /dev/null; then
79
	if type -p tarsync &> /dev/null; then
Lines 123-129 while (( $attempts < 40 )) ; do Link Here
123
		echo " --- No md5sum present on the mirror. (Not yet available.)"
147
		echo " --- No md5sum present on the mirror. (Not yet available.)"
124
		continue
148
		continue
125
	elif [ -s "${FILE}" ]; then
149
	elif [ -s "${FILE}" ]; then
126
		if eval "$md5_com"; then
150
		if eval "$md5_com" && eval "$gpg_com"; then
127
			echo " === snapshot $FILE is correct, using it"
151
			echo " === snapshot $FILE is correct, using it"
128
			sync_local
152
			sync_local
129
			echo
153
			echo
Lines 139-148 while (( $attempts < 40 )) ; do Link Here
139
		URI="${i}/snapshots/$FILE"
163
		URI="${i}/snapshots/$FILE"
140
		rm -f "$FILE"
164
		rm -f "$FILE"
141
		if (eval "$FETCHCOMMAND $wgetops") && [ -s "$FILE" ]; then
165
		if (eval "$FETCHCOMMAND $wgetops") && [ -s "$FILE" ]; then
166
			URI="${i}/snapshots/$FILE.gpgsig"
167
			rm -f "$FILE.gpgsig"
168
169
			if [ $WEBSYNC_VERIFY_SIGNATURE != 0 ]; then
170
				if ! (eval "$FETCHCOMMAND $wgetops") || ! [ -s "$FILE.gpgsig" ]; then
171
					echo "Cannot download signature for $FILE"
172
					continue
173
				fi
174
			fi
175
142
			if ! eval "$md5_com"; then
176
			if ! eval "$md5_com"; then
143
				echo "md5 failed on $FILE"
177
				echo "md5 failed on $FILE"
144
				rm ${FILE}
178
				rm ${FILE}
145
				continue
179
				continue
180
			elif ! eval "$gpg_com"; then
181
				echo "Signature validation failed on $FILE"
182
				rm ${FILE}
183
				continue
146
			else
184
			else
147
				sync_local
185
				sync_local
148
				echo
186
				echo

Return to bug 130039