This repository has been archived on 2023-01-08. You can view files and clone it, but cannot push or open issues or pull requests.
ptrcports/alpine-mirror/alpine-mirror
ptrcnull 411b9c64bb alpine-mirror: upgrade to 1.1.0
allow for setting extra options to rsync
2022-05-15 12:36:25 +02:00

42 lines
900 B
Bash
Executable file

#!/usr/bin/env sh
# make sure we never run 2 rsync at the same time
lockfile="/tmp/alpine-mirror.lock"
if [ -z "$flock" ] ; then
exec env flock=1 flock -n $lockfile "$0" "$@"
fi
# default config
src=rsync://rsync.alpinelinux.org/alpine/
dest=/var/lib/mirror/
versions="edge"
arches="x86_64"
extra_options=""
. /etc/alpine-mirror.conf
mirror() {
mkdir -p "$dest$1"
echo "running rsync $1"
/usr/bin/rsync \
--archive \
--update \
--hard-links \
--delete \
--delete-after \
--delay-updates \
--timeout=600 \
$extra_options \
"$src$1" "$dest$1"
exitcode=$?
[ $exitcode == 0 ] || echo "rsync $1 failed with exit code: $exitcode"
}
for version in $versions; do
for arch in $arches; do
mirror "$version/main/$arch/"
mirror "$version/community/$arch/"
[ "$version" = edge ] && mirror "$version/testing/$arch/"
done
done