summaryrefslogtreecommitdiff
blob: 8f46b384011f0e1437ec1592a3c03b9f5889f8a2 (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
45
46
47
48
49
50
#!/bin/bash
# Copyright 2011-2020 Gentoo Foundation; Distributed under the GPL v2
# might be earlier copyright, no history available
ARCHES="alpha amd64 arm hppa ia64      ppc s390 sh sparc x86"
       #alpha amd64 arm hppa ia64 mips ppc s390 sh sparc x86

# The -rp_*asc filter rules causes rsync to only delete .asc files that are in
# directories that would otherwise be deleted.
RSYNC_OPTS=(
	-aO
	--password-file=/etc/mastermirror-fetch/poseidon-rsync.passwd
	--delete
	--delete-delay
	--timeout=600
	--exclude='.*'
	--filter=-rp_*.asc
	--no-motd
)

# Do NOT expand the following yet
#_SRC='masterdistfiles@poseidon.amd64.dev.gentoo.org::weekly/${ARCH}/'
#_SRC='masterdistfiles@skimmer.gentoo.org::weekly/${ARCH}/'
#_SRC='masterdistfiles@nightheron.gentoo.org::weekly/${ARCH}/'
_SRC='masterdistfiles@releng-incoming.gentoo.org::weekly/${ARCH}/'
_DST_BASE='/var/tmp/gmirror-releases/releases/'
# compat
[[ $HOSTNAME == TODO ]] && _DST_BASE='/var/tmp/gmirror/releases/'
[[ -d $_DST_BASE ]] || mkdir $_DST_BASE
# No expansion is IMPORTANT
_DST=${_DST_BASE}/'${ARCH}'/autobuilds

DEBUG=''
VERBOSE=''
# Nothing to edit beyond this point
DEBUGP=
VERBOSEP=
[ -n "$DEBUG" ] && DEBUGP="echo"
[ -n "$DEBUG" ] && RSYNC_OPTS+=( -n )
if [ -n "$VERBOSE" ]; then
	RSYNC_OPTS+=( -v )
else
	RSYNC_OPTS+=( -q )
fi

for ARCH in $ARCHES ; do
	src="$(eval echo $_SRC)"
	dst="$(eval echo $_DST)"
	$DEBUGP mkdir -pv "$dst"
	rsync "${RSYNC_OPTS[@]}" "$src" "$dst"
done