]> git.wh0rd.org - home.git/blame - .bin/gentoo-sync
screenrc: disable annoying commands
[home.git] / .bin / gentoo-sync
CommitLineData
3815fa0c
MF
1#!/bin/bash
2
8ca6450d 3[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || :
3815fa0c
MF
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
d3768020 13GS_LAYMAN=true
3815fa0c
MF
14conf="/etc/gentoo-sync.conf"
15[[ -e ${conf} ]] && . "${conf}"
16
17export NOCOLOR=true
18
19(
20date
21
22if ${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
d144418d 30 > "${up_log}"
3815fa0c
MF
31 : ${PORTAGE_RSYNC_OPTS:=-azO --delete --exclude=/distfiles --exclude=/local --exclude=/packages}
32 : ${SYNC:=rsync://rsync.gentoo.org/gentoo-portage}
33 : ${PORTDIR:=/usr/portage}
d144418d 34 exec rsync ${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS} ${SYNC}/ ${PORTDIR}/ >& "${sync_log}"
3815fa0c
MF
35fi
36
37emerge --sync -q
38date
39${GS_EUPDATEDB} && $(type -P eupdatedb)
40date
d3768020
MF
41${GS_LAYMAN} && l=$(type -P layman) && ${l} -S -q
42date
3815fa0c
MF
43${GS_FETCH} && emerge world -Duf
44#q -qr
45date
46) >& ${sync_log}
47
48if ${GS_UPWORLD} ; then
49 (
50 eval $(portageq envvar -v PORTDIR)
51 cd "${PORTDIR}"
52 good_pkgs=$(ls -d `qlist -IC`)
53 echo 'emerge -u1 --keep-going $(awk '\''$2 ~ /\// {print $2}'\'' '${up_log}')'
54 emerge ${good_pkgs} -upq --cols
55 ) >& ${up_log}
56fi