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