-
Notifications
You must be signed in to change notification settings - Fork 4
/
rsync-packages
executable file
·44 lines (37 loc) · 1.32 KB
/
rsync-packages
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/sh
# call rsync to mirror all snapshot packages from ftp.hostserver.de
set -eu
if [ $# != 0 ]
then
echo usage: rsync-packages >&2
exit 2
fi
archs="aarch64 alpha amd64 arm hppa i386 mips64 mips64el powerpc powerpc64 sparc64"
host="${host:=217.31.80.35}"
bwlimit="${bwlimit:=1000}"
debug="${debug:=debug}"
rsyncoptions="--delete --exclude .~tmp~ --exclude '.*' --exclude packages"
rsync="/usr/local/bin/rsync --bwlimit=$bwlimit $rsyncoptions"
tag="rsync-packages[$$]"
logger -p daemon.info -t "$tag" "openbsd archs start"
for arch in $archs
do
# make sure that no other job from cron is running
while pgrep -q -u rsyncfetch -f rsync-package-arch
do
sleep 1000
done
# download and verify architecture snapshot package
/data/mirror/openbsd/bin/rsync-package-arch $arch || true
rsyncoptions="$rsyncoptions --exclude $arch"
done
rsync="/usr/local/bin/rsync --bwlimit=$bwlimit $rsyncoptions"
logger -p daemon.notice -t "$tag" "openbsd archs success"
# get everything else that is not an architecture
# packages are handled by another job
logger -p daemon.info -t "$tag" "openbsd remainder start"
url="rsync://$host/OpenBSD/snapshots/packages/"
dir="/data/mirror/openbsd/ftp/snapshots/packages"
eval $rsync -av "$url" "$dir" | logger -p "daemon.$debug" -t rsync
logger -p daemon.notice -t "$tag" "openbsd remainder success"
exit 0