-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrsync-releases
executable file
·37 lines (30 loc) · 1009 Bytes
/
rsync-releases
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
#!/bin/sh
# call rsync to mirror new releases from ftp.hostserver.de
set -eu
if [ $# != 0 ]
then
echo usage: rsync-releases >&2
exit 2
fi
# it does not make sense to download old releases again
excludeversions=`jot - 20 74 1`
host="${host:=217.31.80.35}"
bwlimit="${bwlimit:=1000}"
debug="${debug:=debug}"
rsyncoptions="--exclude .~tmp~ --exclude '.*' --exclude snapshots"
rsync="/usr/local/bin/rsync --bwlimit=$bwlimit $rsyncoptions"
tag="rsync-releases[$$]"
logger -p daemon.info -t "$tag" "openbsd start"
for version in $excludeversions
do
release="${version%[0-9]}.${version##[0-9]}"
rsyncoptions="$rsyncoptions --exclude $release"
done
rsyncoptions="$rsyncoptions --exclude unsupported"
rsync="/usr/local/bin/rsync --bwlimit=$bwlimit $rsyncoptions"
# get everything that is not a snapshot or an old release
url="rsync://$host/OpenBSD/"
dir="/data/mirror/openbsd/ftp"
eval $rsync -av "$url" "$dir" | logger -p "daemon.$debug" -t rsync
logger -p daemon.notice -t "$tag" "openbsd success"
exit 0