]> git.wh0rd.org - home.git/blame - .bin/gentoo-sync
custom-chroot: also mount /dev/shm
[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
9db26d84 9GS_SYNC=true
3815fa0c
MF
10GS_RSYNC=false
11GS_EUPDATEDB=true
12GS_FETCH=false
13GS_UPWORLD=true
d3768020 14GS_LAYMAN=true
3815fa0c
MF
15conf="/etc/gentoo-sync.conf"
16[[ -e ${conf} ]] && . "${conf}"
17
18export NOCOLOR=true
19
20(
21date
22
23if ${GS_RSYNC} ; then
24 # For slow systems, run rsync directly.
25 for f in make.globals make.conf ; do
26 for d in /etc /etc/portage /usr/share/portage/config ; do
27 f="${d}/make.globals"
28 [[ -e ${f} ]] && . ${f} && break
29 done
30 done
d144418d 31 > "${up_log}"
3815fa0c
MF
32 : ${PORTAGE_RSYNC_OPTS:=-azO --delete --exclude=/distfiles --exclude=/local --exclude=/packages}
33 : ${SYNC:=rsync://rsync.gentoo.org/gentoo-portage}
34 : ${PORTDIR:=/usr/portage}
d144418d 35 exec rsync ${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS} ${SYNC}/ ${PORTDIR}/ >& "${sync_log}"
3815fa0c
MF
36fi
37
9db26d84
MF
38if ${GS_SYNC} ; then
39 emerge --sync -q
40 date
41 ${GS_EUPDATEDB} && $(type -P eupdatedb)
42 date
43 ${GS_LAYMAN} && l=$(type -P layman) && ${l} -S -q
44 date
45 ${GS_FETCH} && emerge world -Duf
46 #q -qr
47fi
48
3815fa0c
MF
49date
50) >& ${sync_log}
51
52if ${GS_UPWORLD} ; then
53 (
047f042e
MF
54 repos=(
55 $(portageq repositories_configuration / | awk '$1 == "location" { $1 = $2 = ""; print }')
56 )
9db26d84
MF
57 bad_pkgs=()
58 good_pkgs=()
59 for p in `qlist -ICS` ; do
047f042e
MF
60 good=false
61 for repo in ${repos[@]} ; do
62 if [[ -d ${repo}/${p%:*} ]] ; then
63 good=true
64 break
65 fi
66 done
67
68 if ${good} ; then
9db26d84
MF
69 good_pkgs+=( ${p} )
70 else
71 bad_pkgs+=( ${p} )
72 fi
73 done
047f042e 74
9db26d84
MF
75 if [[ ${#bad_pkgs[@]} -gt 0 ]] ; then
76 echo 'These packages no longer exist:'
77 printf '\t%s\n' "${bad_pkgs[@]}"
78 echo
79 fi
c1eb2d1c 80 echo 'emerge -u1qv --keep-going $(awk '\''$2 ~ /\// {print $2}'\'' '${up_log}')'
047f042e
MF
81 emerge -upq --cols \
82 $(printf '%s\n' ${good_pkgs[*]} | grep -v '^cross-')
3815fa0c
MF
83 ) >& ${up_log}
84fi