]>
git.proxmox.com Git - ceph.git/blob - ceph/mirroring/mirror-ceph.sh
4 # Script to mirror Ceph locally
6 # Please, choose a local source and do not sync in a shorter interval than
11 # All available source mirrors
13 SOURCES
[eu
]="eu.ceph.com"
14 SOURCES
[de
]="de.ceph.com"
15 SOURCES
[se
]="se.ceph.com"
16 SOURCES
[au
]="au.ceph.com"
17 SOURCES
[us
]="download.ceph.com"
18 SOURCES
[hk
]="hk.ceph.com"
19 SOURCES
[fr
]="fr.ceph.com"
20 SOURCES
[us-east
]="us-east.ceph.com"
21 SOURCES
[us-west
]="us-west.ceph.com"
22 SOURCES
[global
]="download.ceph.com"
24 function print_usage
() {
25 echo "$0 [-q ] -s <source mirror> -t <target directory>"
28 while getopts ":qhs:t:" opt
; do
49 if [ ! -z "$HELP" ] ||
[ -z "$TARGET" ] ||
[ -z "$SOURCE" ]; then
54 if [ ! -d "$TARGET" ]; then
55 echo "$TARGET is not a valid target directory"
59 for i
in "${!SOURCES[@]}"; do
60 if [ "$i" == "$SOURCE" ]; then
61 SOURCE_HOST
=${SOURCES[$i]}
65 if [ -z "$SOURCE_HOST" ]; then
66 echo -n "Please select one of the following sources:"
67 for i
in "${!SOURCES[@]}"; do
74 RSYNC_OPTS
="--stats --progress"
75 if [ $SILENT -eq 1 ]; then
79 # We start a two-stage sync here for DEB and RPM
80 # Based on: https://www.debian.org/mirror/ftpmirror
82 # The idea is to prevent temporary situations where metadata points to files
86 # Exclude all metadata files
87 rsync
${RSYNC_OPTS} ${SOURCE_HOST}::ceph
--recursive --times --links \
95 --exclude repodata
/* \
98 # Now also transfer the metadata and delete afterwards
99 rsync
${RSYNC_OPTS} ${SOURCE_HOST}::ceph
--recursive --times --links \
100 --hard-links --delete-after \