#!/bin/sh # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ source /sbin/functions.sh source /etc/make.globals source /etc/make.conf MIRROR_DIR=/home/ftp/pub/gentoo/rsync/ CVSROOT=:pserver:anonymous@cvs.linbsd.net:/cvsroot LN=/bin/ln LS=/bin/ls RM=/bin/rm MKDIR=/bin/mkdir EMERGE=/usr/bin/emerge ebuild_opts="" do_cvs=0 do_rsync=0 while [ "$1" != "" ] ; do case $1 in --help|-h) cat << __EOF__ Usage: $0 -h, --help : This help. -c, --cvs : Checkout files from $CVSROOT into your $PORTDIR_OVERLAY -r, --rsync : Preform an rsync with ${SYNC} to ${MIRROR_DIR} The remaining arguments are treated as ebuild options to preform on each ebuild in your PORTDIR_OVERLAY __EOF__ exit 0 ;; --cvs|-c) do_cvs=1;; --rsync|-r) do_rsync=1;; *) ebuild_opts="${ebuild_opts} $1" esac shift done einfo "do_cvs=$do_cvs do_rsync=$do_rsync ebuild_opts=$ebuild_opts" if [ ! -d "${PORTDIR_OVERLAY}" ]; then eerror "PORTDIR_OVERLAY[${PORTDIR_OVERLAY}] must be a valid dir" exit 1 fi if [ $do_rsync == 1 ] ; then einfo "Rsyncing with ${SYNC}" /usr/bin/rsync -rlptDvz --delete ${SYNC} ${MIRROR_DIR} if [ $? != 0 ] ; then eerror "Error rsyncing?" exit 1 fi fi if [ $do_cvs == 1 ] ; then einfo "Grabbing cvs overlay snapshot from ${CVSROOT}" cd ${PORTDIR_OVERLAY} cd .. cvs -d ${CVSROOT} co portage || ewarn "Error fetching portage from cvs $CVSROOT" cd - fi ${MKDIR} -p ${MIRROR_DIR} find ${PORTDIR_OVERLAY} -name CVS -type d | while read dirp; do rm -rf ${dirp} done cd ${PORTDIR_OVERLAY} ${LS} -1 | grep ^[a-z] | while read catagory; do if [ -d "${catagory}" ]; then cd ${catagory} ${LS} -1 | while read edir; do if [ -d "${edir}" ] ; then einfo "Adding local ${catagory}/${edir} to local rsync mirror in ${MIRROR_DIR}" if [ "${ebuild_opts}" != "" ]; then cd ${edir} find . -name '*.ebuild' | while read ebuild; do einfo ebuild ${ebuild} ${ebuild_opts} ebuild ${ebuild} ${ebuild_opts} done cd .. fi ${MKDIR} -p ${MIRROR_DIR}/${catagory}/ cp -dpR ${PORTDIR_OVERLAY}/${catagory}/${edir} ${MIRROR_DIR}/${catagory}/ fi done cd .. fi done