--- /usr/sbin/emerge-webrsync 2005-12-28 11:49:18.000000000 +0100 +++ emerge-webrsync 2006-01-11 09:28:54.378088760 +0100 @@ -18,9 +18,25 @@ cd "$DISTDIR" found=0 +rsyncops="-av --progress" + +PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS) + +if [[ -n $PORTAGE_NICENESS ]] && [[ -z $WE_ARE_NICED ]]; then + export WE_ARE_NICED=1 + exec nice -n "$PORTAGE_NICENESS" "$0" "$@" +fi + +if [ -z "$PORTAGE_NICENESS" ] ; then + PORTAGE_NICENESS=0 +fi + if [ "$1" == "-v" ] ; then wgetops= else + if [ "$1" == "-q" ] ; then + rsyncops="-aq" + fi #this sucks. probably better to do 1> /dev/null #that said, waiting on the refactoring. if [ "${FETCHCOMMAND/wget}" != "${FETCHCOMMAND}" ]; then @@ -42,23 +58,31 @@ sync_local() { echo Syncing local tree... - if ! tar jxf $FILE; then - echo "Tar failed to extract the image. Please review the output." - echo "Executed command: tar jxf $FILE" - exit 1 - fi + if type -p tarsync &> /dev/null; then + echo "apparently you have tarsync installed. using it." + if ! nice -n $PORTAGE_NICENESS tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o portage -g portage -e /distfiles -e /packages -e /local; then + echo "ok, tarsync failed. that's teh suck :/" + exit 6 + fi + else + if ! nice -n $PORTAGE_NICENESS tar jxf $FILE; then + echo "Tar failed to extract the image. Please review the output." + echo "Executed command: tar jxf $FILE" + exit 1 + fi + fi rm -f $FILE # Make sure user and group file ownership is root chown -R 0:0 portage cd portage - rsync -av --progress --stats --delete --delete-after \ + nice -n $PORTAGE_NICENESS rsync ${rsyncops} --stats --delete --delete-after \ --exclude='/distfiles' --exclude='/packages' \ --exclude='/local' . ${PORTDIR%%/} cd .. echo "cleaning up" rm -rf portage echo "transferring metadata/cache" - emerge metadata + nice -n $PORTAGE_NICENESS emerge metadata } echo "Fetching most recent snapshot"