From 3815fa0c06051ce0af98b39a3e0d0e9b9b79ee67 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 5 Oct 2012 17:05:13 -0400 Subject: [PATCH] unify gentoo-sync script --- .bin/gentoo-sync | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 .bin/gentoo-sync diff --git a/.bin/gentoo-sync b/.bin/gentoo-sync new file mode 100755 index 0000000..5e84584 --- /dev/null +++ b/.bin/gentoo-sync @@ -0,0 +1,52 @@ +#!/bin/bash + +[[ ${FLOCKER} != $0 ]] && exec env FLOCKER=$0 flock -en $0 -c "$0 $*" || : + +logdir="/var/log" +sync_log="${logdir}/rsync.log" +up_log="${logdir}/emerge-updates.log" + +GS_RSYNC=false +GS_EUPDATEDB=true +GS_FETCH=false +GS_UPWORLD=true +conf="/etc/gentoo-sync.conf" +[[ -e ${conf} ]] && . "${conf}" + +export NOCOLOR=true + +( +date + +if ${GS_RSYNC} ; then + # For slow systems, run rsync directly. + for f in make.globals make.conf ; do + for d in /etc /etc/portage /usr/share/portage/config ; do + f="${d}/make.globals" + [[ -e ${f} ]] && . ${f} && break + done + done + : ${PORTAGE_RSYNC_OPTS:=-azO --delete --exclude=/distfiles --exclude=/local --exclude=/packages} + : ${SYNC:=rsync://rsync.gentoo.org/gentoo-portage} + : ${PORTDIR:=/usr/portage} + exec rsync ${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS} ${SYNC}/ ${PORTDIR}/ +fi + +emerge --sync -q +date +${GS_EUPDATEDB} && $(type -P eupdatedb) +date +${GS_FETCH} && emerge world -Duf +#q -qr +date +) >& ${sync_log} + +if ${GS_UPWORLD} ; then + ( + eval $(portageq envvar -v PORTDIR) + cd "${PORTDIR}" + good_pkgs=$(ls -d `qlist -IC`) + echo 'emerge -u1 --keep-going $(awk '\''$2 ~ /\// {print $2}'\'' '${up_log}')' + emerge ${good_pkgs} -upq --cols + ) >& ${up_log} +fi -- 2.39.5