#!/bin/sh if [ $# -lt 3 ]; then echo "usage: $0 arch branch buildid" exit 1 fi # configurable variables pbc=${PORTBUILD_CHECKOUT:-/a/portbuild} pbd=${PORTBUILD_DATA:-/a/portbuild} . ${pbc}/conf/server.conf arch=$1 branch=$2 buildid=$3 builddir=${pbd}/${arch}/${branch}/builds/${buildid} yesreally=0 dryrun=-n cleanup=0 if [ "$4" = "-yesreally" ]; then yesreally=1 dryrun= elif [ "$4" = "-cleanup" ]; then cleanup=1 fi distdir=${builddir}/distfiles/ log=${builddir}/logs/.distfiles if [ "${cleanup}" -eq 1 ]; then echo "Removing distfiles" rm -rf ${distdir} || exit 1 exit 0 fi if [ -e ${distdir}/.pbtmp ]; then echo "${distdir} has not been processed!" exit 1 fi rsync ${dryrun} -r -v -l -t \ --exclude RESTRICTED/ \ ${builddir}/distfiles/ \ ${UPLOAD_USER}@${UPLOAD_TARGET}:${UPLOAD_DIRECTORY} | \ tee ${log} num=$(wc -l ${log} | awk '{print $1}') if [ "$yesreally" = "0" ]; then echo "--> Will transfer ${num} files - make sure this is what you want and rerun '$0 $* -yesreally'" else echo "--> Transferred ${num} files - results in ${log}" echo " Now run '$0 $1 $2 $3 -cleanup' to remove distfiles and save space" fi