2 # Copyright 1999-2013 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.
5 # Rewritten from the old, Perl-based emerge-webrsync script
10 # gpg --homedir /etc/portage/gnupg --keyserver subkeys.pgp.net --recv-keys $KEY_ID
11 # gpg --homedir /etc/portage/gnupg --edit-key $KEY_ID trust
16 # Only echo if not in verbose mode
17 nvecho() { [[ ${do_verbose} -eq 0 ]] && echo "$@" ; }
19 wecho() { echo "${argv0##*/}: warning: $*" 1>&2 ; }
21 eecho() { echo "${argv0##*/}: error: $*" 1>&2 ; }
28 # Use portageq from the same directory/prefix as the current script, so
29 # that we don't have to rely on PATH including the current EPREFIX.
30 scriptpath=${BASH_SOURCE[0]}
31 if [ -x "${scriptpath%/*}/portageq" ]; then
32 portageq=${scriptpath%/*}/portageq
33 elif type -P portageq > /dev/null ; then
36 eecho "could not find 'portageq'; aborting"
39 eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
40 FETCHCOMMAND GENTOO_MIRRORS \
41 PORTAGE_BIN_PATH PORTAGE_CONFIGROOT PORTAGE_GPG_DIR \
42 PORTAGE_NICENESS PORTAGE_REPOSITORIES PORTAGE_RSYNC_EXTRA_OPTS \
43 PORTAGE_RSYNC_OPTS PORTAGE_TMPDIR \
44 USERLAND http_proxy ftp_proxy)"
45 export http_proxy ftp_proxy
47 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit
50 repo_location=$(__repo_key "${repo_name}" location)
51 if [[ -z ${repo_location} ]]; then
52 eecho "Repository '${repo_name}' not found"
56 if [ -z "$NICENESS_PULLED" ]; then
57 if [ -n "${PORTAGE_NICENESS}" ]; then
58 export NICENESS_PULLED=asdf
59 exec nice -n "${PORTAGE_NICENESS}" "$0" "$@"
60 echo "failed setting PORTAGE_NICENESS to '$PORTAGE_NICENESS', disabling"
64 STATE_DIR="${EPREFIX}/var/delta-webrsync/"
67 if [ "${FETCHCOMMAND/getdelta.sh}" != "${FETCHCOMMAND}" ]; then
69 eval "$(grep "^FETCHCOMMAND=" "${EPREFIX}/usr/share/portage/config/make.globals")"
85 if [[ $x == "-u" ]]; then
87 elif [[ $x == "-k" ]]; then
89 elif [[ $x == "-h" ]]; then
91 elif [[ $x == "-v" ]]; then
95 echo "$x isn't a valid arg. bailing."
97 if [[ -n $PUKE_HELP ]]; then
98 echo "-u for upgrade; sync only if new snapshots are found"
99 echo "-k for keep; keep old tree snapshots around"
104 if [[ ! -d $STATE_DIR ]]; then
105 echo "$STATE_DIR doesn't exist. don't have the ability to compensate for compressor differences without it!"
109 if has webrsync-gpg ${FEATURES} ; then
110 WEBSYNC_VERIFY_SIGNATURE=1
112 WEBSYNC_VERIFY_SIGNATURE=0
114 if [ ${WEBSYNC_VERIFY_SIGNATURE} != 0 -a -z "${PORTAGE_GPG_DIR}" ]; then
115 eecho "please set PORTAGE_GPG_DIR in make.conf"
119 [[ -d ${repo_location} ]] || mkdir -p "${repo_location}"
120 if [[ ! -w ${repo_location} ]] ; then
121 eecho "Repository '${repo_name}' is not writable: ${repo_location}"
125 [[ -d ${DISTDIR} ]] || mkdir -p "${DISTDIR}"
126 if [[ ! -w ${DISTDIR} ]] ; then
127 eecho "DISTDIR is not writable: ${DISTDIR}"
131 [[ -d ${PORTAGE_TMPDIR}/portage ]] || mkdir -p "${PORTAGE_TMPDIR}/portage"
132 TMPDIR=$(mktemp -d "${PORTAGE_TMPDIR}/portage/delta-webrsync-XXXXXX")
133 if [[ ! -w ${TMPDIR} ]] ; then
134 eecho "TMPDIR is not writable: ${TMPDIR}"
142 if type -p md5sum > /dev/null; then
143 md5_com='md5sum -c "${MD5_LOC}" &> /dev/null'
144 elif type -p md5 > /dev/null; then
145 md5_com='[ "$(md5 -q ${FILE})" == "$(cut -d \ -f 1 ${MD5_LOC})" ]'
147 echo "warning, unable to do md5 verification of the snapshot!"
148 echo "no suitable md5/md5sum binary was found!"
156 cleanse_state_dir() {
157 [[ ${STATE_DIR:-/} != '/' ]] && rm -f "${STATE_DIR}"/* &> /dev/null
164 *.xz) decompressor="xzcat" ;;
165 *.bz2) decompressor="bzcat" ;;
166 *.gz) decompressor="zcat" ;;
167 *) decompressor="cat" ;;
169 ${decompressor} "${file}" | tar "$@"
170 _pipestatus=${PIPESTATUS[*]}
171 [[ ${_pipestatus// /} -eq 0 ]]
174 get_utc_date_in_seconds() {
179 local utc_time_in_secs="$1"
182 if [[ ${USERLAND} == BSD ]] ; then
183 date -r ${utc_time_in_secs} -u +"${part}"
185 date -d @${utc_time_in_secs} -u +"${part}"
189 get_utc_second_from_string() {
191 if [[ ${USERLAND} == BSD ]] ; then
192 # Specify zeros for the least significant digits, or else those
193 # digits are inherited from the current system clock time.
194 date -juf "%Y%m%d%H%M.%S" "${s}0000.00" +"%s"
196 date -d "${s:0:4}-${s:4:2}-${s:6:2}" -u +"%s"
200 get_portage_timestamp() {
201 local portage_current_timestamp=0
203 if [ -f "${repo_location}/metadata/timestamp.x" ]; then
204 portage_current_timestamp=$(cut -f 1 -d " " "${repo_location}/metadata/timestamp.x" )
207 echo "${portage_current_timestamp}"
211 local s="$1" inc="$2"
212 if [[ ${USERLAND} == BSD ]] ; then
213 # Specify zeros for the least significant digits, or else those
214 # digits are inherited from the current system clock time.
215 date -v${inc}d -juf "%Y%m%d%H%M.%S" "${s}0000.00" +"%Y%m%d"
217 date -d "${s:0:4}-${s:4:2}-${s:6:2} ${inc} day" -u +"%Y%m%d"
227 if [ "${FETCHCOMMAND/wget/}" != "${FETCHCOMMAND}" ]; then
228 opts="--continue $(nvecho -q)"
229 elif [ "${FETCHCOMMAND/curl/}" != "${FETCHCOMMAND}" ]; then
230 opts="--continue-at - $(nvecho -s -f)"
232 rm -f "${DISTDIR}/${FILE}"
235 __vecho "Fetching file ${FILE} ..."
236 # already set DISTDIR=
237 eval "${FETCHCOMMAND} ${opts}"
238 if [[ $? -eq 0 && -s ${DISTDIR}/${FILE} ]] ; then
241 rm -f "${DISTDIR}/${FILE}"
246 check_file_digest() {
251 __vecho "Checking digest ..."
253 if type -P md5sum > /dev/null; then
254 local md5sum_output=$(md5sum "${file}")
255 local digest_content=$(< "${digest}")
256 [ "${md5sum_output%%[[:space:]]*}" = "${digest_content%%[[:space:]]*}" ] && r=0
257 elif type -P md5 > /dev/null; then
258 [ "$(md5 -q "${file}")" == "$(cut -d ' ' -f 1 "${digest}")" ] && r=0
260 eecho "cannot check digest: no suitable md5/md5sum binaries found"
266 check_file_signature() {
271 if [[ ${WEBSYNC_VERIFY_SIGNATURE} != 0 ]] ; then
273 __vecho "Checking signature ..."
275 if type -P gpg > /dev/null; then
276 gpg --homedir "${PORTAGE_GPG_DIR}" --verify "$signature" "$file" && r=0
278 eecho "cannot check signature: gpg binary not found"
288 get_snapshot_timestamp() {
291 do_tar "${file}" --to-stdout -xf - portage/metadata/timestamp.x | cut -f 1 -d " "
297 __vecho "Syncing local tree ..."
299 local ownership="portage:portage"
300 if has usersync ${FEATURES} ; then
301 case "${USERLAND}" in
303 ownership=$(stat -f '%Su:%Sg' "${repo_location}")
306 ownership=$(stat -c '%U:%G' "${repo_location}")
311 if type -P tarsync > /dev/null ; then
312 local chown_opts="-o ${ownership%:*} -g ${ownership#*:}"
313 chown ${ownership} "${repo_location}" > /dev/null 2>&1 || chown_opts=""
314 if ! tarsync $(__vecho -v) -s 1 ${chown_opts} \
315 -e /distfiles -e /packages -e /local "${file}" "${repo_location}"; then
316 eecho "tarsync failed; tarball is corrupt? (${file})"
320 if ! do_tar "${file}" xf - -C "${TMPDIR}" ; then
321 eecho "tar failed to extract the image. tarball is corrupt? (${file})"
322 rm -fr "${TMPDIR}"/portage
326 local rsync_opts="${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS}"
327 if chown ${ownership} "${TMPDIR}"/portage > /dev/null 2>&1; then
328 chown -R ${ownership} "${TMPDIR}"/portage
329 rsync_opts+=" --owner --group"
331 cd "${TMPDIR}"/portage
332 rsync ${rsync_opts} . "${repo_location%%/}"
335 __vecho "Cleaning up ..."
339 if has metadata-transfer ${FEATURES} ; then
340 __vecho "Updating cache ..."
341 "${PORTAGE_BIN_PATH}/emerge" --metadata
343 local post_sync=${PORTAGE_CONFIGROOT}etc/portage/bin/post_sync
344 [ -x "${post_sync}" ] && "${post_sync}"
345 # --quiet suppresses output if there are no relevant news items
346 has news ${FEATURES} && "${PORTAGE_BIN_PATH}/emerge" --check-news --quiet
351 local ignore_timestamp="$1"
356 local base_file="portage-${date}.tar"
361 local compressions=""
362 type -P bzcat > /dev/null && compressions="${compressions} bz2"
364 if [[ -z ${compressions} ]] ; then
365 eecho "unable to locate any decompressors (xzcat or bzcat or zcat)"
369 for mirror in ${GENTOO_MIRRORS} ; do
372 __vecho "Trying to retrieve ${date} snapshot from ${mirror} ..."
374 for compression in ${compressions} ; do
375 local file="portage-${date}.tar.${compression}"
376 local digest="${file}.md5sum"
377 local signature="${file}.gpgsig"
379 if [ -s "${DISTDIR}/${file}" -a -s "${DISTDIR}/${digest}" -a -s "${DISTDIR}/${signature}" ] ; then
380 check_file_digest "${DISTDIR}/${digest}" "${DISTDIR}/${file}" && \
381 check_file_signature "${DISTDIR}/${signature}" "${DISTDIR}/${file}" && \
385 if [ ${have_files} -eq 0 ] ; then
386 fetch_file "${mirror}/snapshots/${digest}" "${digest}" && \
387 fetch_file "${mirror}/snapshots/${signature}" "${signature}" && \
388 fetch_file "${mirror}/snapshots/${file}" "${file}" && \
389 check_file_digest "${DISTDIR}/${digest}" "${DISTDIR}/${file}" && \
390 check_file_signature "${DISTDIR}/${signature}" "${DISTDIR}/${file}" && \
395 # If timestamp is invalid
396 # we want to try and retrieve
397 # from a different mirror
399 if [ ${have_files} -eq 1 ]; then
401 __vecho "Getting snapshot timestamp ..."
402 local snapshot_timestamp=$(get_snapshot_timestamp "${DISTDIR}/${file}")
404 if [ ${ignore_timestamp} == 0 ]; then
405 if [ ${snapshot_timestamp} -lt $(get_portage_timestamp) ]; then
406 wecho "portage is newer than snapshot"
410 local utc_seconds=$(get_utc_second_from_string "${date}")
413 # Check that this snapshot
414 # is what it claims to be ...
416 if [ ${snapshot_timestamp} -lt ${utc_seconds} ] || \
417 [ ${snapshot_timestamp} -gt $((${utc_seconds}+ 2*86400)) ]; then
419 wecho "snapshot timestamp is not in acceptable period"
425 if [ ${have_files} -eq 1 ]; then
429 # Remove files and use a different mirror
431 rm -f "${DISTDIR}/${file}" "${DISTDIR}/${digest}" "${DISTDIR}/${signature}"
435 [ ${have_files} -eq 1 ] && break
438 if [ ${have_files} -eq 1 ]; then
439 sync_local "${DISTDIR}/${file}" && r=0
441 __vecho "${date} snapshot was not found"
447 do_latest_snapshot() {
451 __vecho "Fetching most recent snapshot ..."
453 # The snapshot for a given day is generated at 00:45 UTC on the following
454 # day, so the current day's snapshot (going by UTC time) hasn't been
455 # generated yet. Therefore, always start by looking for the previous day's
456 # snapshot (for attempts=1, subtract 1 day from the current UTC time).
458 # Timestamps that differ by less than 2 hours
459 # are considered to be approximately equal.
460 local min_time_diff=$(( 2 * 60 * 60 ))
462 local existing_timestamp=$(get_portage_timestamp)
463 local timestamp_difference
464 local timestamp_problem
465 local approx_snapshot_time
466 local start_time=$(get_utc_date_in_seconds)
467 local start_hour=$(get_date_part ${start_time} "%H")
469 # Daily snapshots are created at 00:45 and are not
470 # available until after 01:00. Don't waste time trying
471 # to fetch a snapshot before it's been created.
472 if [ ${start_hour} -lt 1 ] ; then
473 (( start_time -= 86400 ))
475 local snapshot_date=$(get_date_part ${start_time} "%Y%m%d")
476 local snapshot_date_seconds=$(get_utc_second_from_string ${snapshot_date})
478 while (( ${attempts} < 40 )) ; do
480 (( snapshot_date_seconds -= 86400 ))
481 # snapshots are created at 00:45
482 (( approx_snapshot_time = snapshot_date_seconds + 86400 + 2700 ))
483 (( timestamp_difference = existing_timestamp - approx_snapshot_time ))
484 [ ${timestamp_difference} -lt 0 ] && (( timestamp_difference = -1 * timestamp_difference ))
485 snapshot_date=$(get_date_part ${snapshot_date_seconds} "%Y%m%d")
488 if [ ${timestamp_difference} -eq 0 ]; then
489 timestamp_problem="is identical to"
490 elif [ ${timestamp_difference} -lt ${min_time_diff} ]; then
491 timestamp_problem="is possibly identical to"
492 elif [ ${approx_snapshot_time} -lt ${existing_timestamp} ] ; then
493 timestamp_problem="is newer than"
496 if [ -n "${timestamp_problem}" ]; then
497 ewarn "Latest snapshot date: ${snapshot_date}"
499 ewarn "Approximate snapshot timestamp: ${approx_snapshot_time}"
500 ewarn " Current local timestamp: ${existing_timestamp}"
502 echo -e "The current local timestamp" \
503 "${timestamp_problem} the" \
504 "timestamp of the latest" \
505 "snapshot. In order to force sync," \
506 "use the --revert option or remove" \
507 "the timestamp file located at" \
508 "'${repo_location}/metadata/timestamp.x'." | fmt -w 70 | \
509 while read -r line ; do
516 if do_snapshot 0 "${snapshot_date}"; then
525 fetch_from_mirrors() {
526 local i URI FILE MIRRORS
527 if [[ "$#" == 3 ]]; then
530 MIRRORS=$GENTOO_MIRRORS
533 for i in $MIRRORS ; do
535 fetch_file "${URI}" "${FILE}" && return 0
543 if [[ $# == 2 ]]; then
546 MD5_LOC="$(pwd)/$1.md5sum"
548 check_file_digest "${MD5_LOC}" "${FILE}"
551 #--------------------
552 #inline actual script
553 #--------------------
555 if ! type -p patcher &> /dev/null; then
557 echo "!!! cannot find patcher, did you emerge dev-util/diffball?"
558 echo "!!! lack of patcher == have to do full fetch"
561 if do_latest_snapshot; then
569 echo "Looking for available base versions for a delta"
571 #note we're already in distdir
574 # portage-snapshots in reverse order.
577 potentials="$(ls -1 portage-2[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]].tar.bz2 ${STATE_DIR}/portage-2[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]].tar.bz2 2> /dev/null | sed -e 's:^.*/::' | sort -r)"
578 for basef in ${potentials}; do
581 if [ -e "${STATE_DIR}/${basef}.md5sum" ]; then
582 chksum="${STATE_DIR}/${basef}.md5sum"
583 elif [ -e "${basef}.md5sum" ]; then
584 chksum="${DISTDIR}/${basef}.md5sum"
586 echo "attempting to get md5sum for $basef"
587 if ! fetch_from_mirrors "/snapshots/${basef}.md5sum" "${basef}.md5sum"; then
588 echo "can't get md5 for ${basef}"
591 chksum="${basef}.md5sum"
593 if [ -e "${basef}" ]; then
594 dfile="${DISTDIR}/${basef}"
596 dfile="${STATE_DIR}/${basef}"
598 if ! verify_md5_file "${dfile}" "${chksum}"; then
599 echo "found a stale snapshot. cleansing"
600 rm -f "${dfile}" &> /dev/null
601 rm -f "${chksum}.md5sum" &> /dev/null
604 base_version="${basef}"
609 #by this point, we either have a base_version, or we don't.
610 if [[ -z ${base_version} ]]; then
611 echo "no base found. resorting to pulling a full version"
612 if do_latest_snapshot; then
620 #we have a md5 verified base. now we get the patch.
622 base_date="${base_version%.tar.bz2}"
623 base_date="${base_date#portage-}"
624 # we now have yyyymmdd
627 echo "fetching patches"
629 while [[ -n ${fetched} ]]; do
630 next_day=$(increment_date ${base_date} +1)
631 # if we can't get a *single* patch or md5, even one missing, do full.
632 p="snapshot-${base_date}-${next_day}.patch.bz2"
633 if [[ ! -e ${p}.md5sum ]] && ! fetch_from_mirrors "/snapshots/deltas/${p}.md5sum" "${p}.md5sum"; then
634 echo "failed fetching ${p}.md5sum"
639 if [[ -e ${p} ]]; then
640 if ! verify_md5_file "${p}"; then
641 rm -f "${p}" &> /dev/null
646 if [[ -n $fetch ]]; then
647 if ! fetch_from_mirrors "/snapshots/deltas/${p}" "${p}"; then
648 echo "failed fetching ${p}"
652 if [[ -z ${fetched} ]]; then
655 if ! verify_md5_file "${p}"; then
656 echo "md5 failed on ${p}"
660 patches="${patches} ${p}"
661 base_date="${next_day}"
663 final_date=${base_date}
665 if [[ -z $patches ]]; then
666 echo "no patches found? up to date?"
667 if [[ -n $MUST_SYNC ]]; then
668 echo "syncing with existing file"
669 if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 &&
670 ! -e ${DISTDIR}/portage-${base_date}.tar.bz2.gpgsig ]] && \
671 ! fetch_from_mirrors "/snapshots/portage-${base_date}.tar.bz2.gpgsig" "portage-${base_date}.tar.bz2.gpgsig" ; then
672 eecho "Couldn't fetch portage-${base_date}.tar.bz2.gpgsig"
675 if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
676 check_file_signature "${DISTDIR}/portage-${base_date}.tar.bz2.gpgsig" "${dfile}" || exit 1
678 sync_local "${dfile}" && rm -fr "${TMPDIR}"
686 #grab the md5 for later usage.
687 if [[ ! -e portage-${final_date}.tar.bz2.md5sum ]] && ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.md5sum" "portage-${final_date}.tar.bz2.md5sum"; then
688 echo "warning... couldn't grab the md5sum for ${final_date}. which is odd"
689 echo "thus, bailing (sorry)"
692 if [[ ! -e portage-${final_date}.tar.bz2.umd5sum ]] && ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.umd5sum" "portage-${final_date}.tar.bz2.umd5sum"; then
693 if ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.umd5sum" "portage-${final_date}.tar.bz2.umd5sum"; then
694 echo "couldn't grab umd5sum (uncompressed md5sum) for ${final_date}."
695 echo "can't compensate for bzip2 version differences iow."
704 if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 && ! -e portage-${final_date}.tar.bz2.gpgsig ]] && \
705 ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.gpgsig" "portage-${final_date}.tar.bz2.gpgsig" ; then
706 echo "warning... couldn't grab the gpgsig for ${final_date}. which is odd"
707 echo "thus, bailing (sorry)"
712 if ! patcher -v "${dfile}" ${patches} "${TMPDIR}/portage-${final_date}.tar"; then
713 echo "reconstruction failed (contact the author with the error from the reconstructor please)"
714 rm -f "${TMPDIR}/portage-${final_date}.tar"
715 if do_latest_snapshot; then
723 if [[ -n $got_umd5 ]]; then
724 echo "verifying uncompressed md5"
725 if ! verify_md5_file "${TMPDIR}/portage-${final_date}.tar" "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum"; then
726 echo "uncompressed verification failed. This means either you found a bug in diffball, or something odd is going on"
727 echo "with upstream patch generation"
728 echo "trying md5sum next, which probably will fail."
735 if [ "$verified" == "1" ]; then
737 if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
738 # BUG: Signature verification will fail if the local bzip2
739 # program does not produce output that is perfectly identical
740 # to the bzip2 program used to compress the signed tar file.
741 echo "recompressing ..."
742 bzip2 -vk9 "${TMPDIR}/portage-${final_date}.tar"
743 check_file_signature "${DISTDIR}/portage-${final_date}.tar.bz2.gpgsig" "${TMPDIR}/portage-${final_date}.tar.bz2" || exit 1
745 echo "recompressing. (backgrounding)"
746 bzip2 -vk9 "${TMPDIR}/portage-${final_date}.tar" &
749 echo "beginning update to the tree"
750 sync_local "${TMPDIR}/portage-${final_date}.tar"
751 echo "doing final md5 stuff"
753 # bzip2 is finished now.
754 rm -f "${TMPDIR}/portage-${final_date}.tar"
756 echo "recompressing."
757 bzip2 -v9 "${TMPDIR}/portage-${final_date}.tar.bz2"
760 echo "verifying generated tarball"
762 if ! verify_md5_file "${TMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/portage-${final_date}.tar.bz2.md5sum"; then
763 if [[ -z $verified ]]; then
764 echo "couldn't verify the generated tarball. bug, most likely."
767 # hokay. md5 doesn't agree with umd5. bzip2 issue in effect.
768 echo "compressed md5 differs, but uncompressed md5 says it right. bzip2 version incompatability in other words"
769 echo "saving the md5"
770 if type -p md5sum &> /dev/null; then
771 md5sum "${TMPDIR}/portage-${final_date}.tar.bz2" | sed -e "s:${TMPDIR}/\?::" > \
772 "${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum"
773 elif type -p md5 &> /dev/null; then
774 echo "$(md5 -q "${TMPDIR}/portage-${final_date}.tar.bz2") portage-${final_date}.tar.bz2" > \
775 "${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum"
777 echo "couldn't find either md5 or md5sum. something is screwed... (bailing, sorry)"
780 mv "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum" "${TMPDIR}/portage-${final_date}.tar.bz2" "${STATE_DIR}/"
781 dfile="${STATE_DIR}/portage-${final_date}.tar.bz2"
783 dfile="${DISTDIR}/portage-${final_date}.tar.bz2"
784 mv "${TMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/"
787 if [ -z "${need_last_sync}" ]; then
788 if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
789 check_file_signature "${DISTDIR}/portage-${final_date}.tar.bz2.gpgsig" "${dfile}" || exit 1
791 echo "beginning update to the tree"
792 sync_local "${dfile}"
795 for x in ${patches} ; do
796 rm -f "${DISTDIR}/${x}"{,.md5sum}
799 if [[ -z $KEEP_OLDIES ]]; then
801 for x in $potentials; do
803 rm -f "${DISTDIR}/${x}"{,.md5sum,.umd5sum,.gpgsig} &> /dev/null
804 rm -f "${STATE_DIR}/${x}"{,.md5sum,.umd5sum} &> /dev/null