blob: 371e2dc51abe44509876a460de95db76b4ebe073 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/bin/bash
# $Header: /var/cvsroot/gentoo-projects/portage-utils/qsync,v 1.7 2006/08/21 00:14:57 solar Exp $
get_portage_var() {
local var=$1 val
[[ -n ${!var} ]] && return 0
val=$(source /etc/make.globals 2>/dev/null ; source /etc/make.conf 2>/dev/null ; echo ${!var})
[[ -n ${val} ]] && export ${var}=${val} && return
export ${var}=$(portageq envvar ${var})
[[ -z ${!var} ]] && export ${var}=$2
}
get_portage_var PORTDIR /usr/portage
get_portage_var RSYNC_TIMEOUT 300
get_portage_var RSYNC_EXCLUDEFROM
get_portage_var SYNC
[[ -z ${SYNC} ]] && echo could not get SYNC var && exit 1
add() { RSYNC_OPTS="${RSYNC_OPTS} $@" ; }
RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --delete-after --stats --timeout=${RSYNC_TIMEOUT}
--exclude=/distfiles --exclude=/local --exclude=/packages --progress"
[[ -n ${RSYNC_EXCLUDEFROM} ]] && add --exclude-from="${RSYNC_EXCLUDEFROM}"
METADATA_ONLY=0
while [[ -n $1 ]] ; do
x=$1
shift
case ${x} in
-v|--verbose) add --verbose ;;
-q|--quiet) add --quiet ;;
--metadata) METADATA_ONLY=1 ;;
--) break ;;
*) echo unknown opt "${x}" ; exit 1 ;;
esac
done
set -x
if [[ ${METADATA_ONLY} -eq 1 ]] ; then
#echo /usr/bin/rsync ${RSYNC_OPTS} "$@" ${SYNC}/profiles ${PORTDIR}
/usr/bin/rsync ${RSYNC_OPTS} "$@" ${SYNC}/metadata/ ${PORTDIR}/metadata/
else
/usr/bin/rsync ${RSYNC_OPTS} "$@" ${SYNC} ${PORTDIR} || exit 1
/usr/bin/rsync --progress -a ${PORTDIR}/metadata/cache/ /var/cache/edb/dep${PORTDIR}/
fi
|