]> git.wh0rd.org - home.git/blame - .bin/gentoo-sync
g4 wrapper
[home.git] / .bin / gentoo-sync
CommitLineData
3815fa0c
MF
1#!/bin/bash
2
3[[ ${FLOCKER} != $0 ]] && exec env FLOCKER=$0 flock -en $0 -c "$0 $*" || :
4
5logdir="/var/log"
6sync_log="${logdir}/rsync.log"
7up_log="${logdir}/emerge-updates.log"
8
9GS_RSYNC=false
10GS_EUPDATEDB=true
11GS_FETCH=false
12GS_UPWORLD=true
13conf="/etc/gentoo-sync.conf"
14[[ -e ${conf} ]] && . "${conf}"
15
16export NOCOLOR=true
17
18(
19date
20
21if ${GS_RSYNC} ; then
22 # For slow systems, run rsync directly.
23 for f in make.globals make.conf ; do
24 for d in /etc /etc/portage /usr/share/portage/config ; do
25 f="${d}/make.globals"
26 [[ -e ${f} ]] && . ${f} && break
27 done
28 done
29 : ${PORTAGE_RSYNC_OPTS:=-azO --delete --exclude=/distfiles --exclude=/local --exclude=/packages}
30 : ${SYNC:=rsync://rsync.gentoo.org/gentoo-portage}
31 : ${PORTDIR:=/usr/portage}
32 exec rsync ${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS} ${SYNC}/ ${PORTDIR}/
33fi
34
35emerge --sync -q
36date
37${GS_EUPDATEDB} && $(type -P eupdatedb)
38date
39${GS_FETCH} && emerge world -Duf
40#q -qr
41date
42) >& ${sync_log}
43
44if ${GS_UPWORLD} ; then
45 (
46 eval $(portageq envvar -v PORTDIR)
47 cd "${PORTDIR}"
48 good_pkgs=$(ls -d `qlist -IC`)
49 echo 'emerge -u1 --keep-going $(awk '\''$2 ~ /\// {print $2}'\'' '${up_log}')'
50 emerge ${good_pkgs} -upq --cols
51 ) >& ${up_log}
52fi