Created
February 22, 2026 21:41
-
-
Save frederickding/6dc2917353036dcc121f5b6c82cacb41 to your computer and use it in GitHub Desktop.
Alpine mirror rsync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 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 | |
| trap "kill 0" SIGINT SIGTERM | |
| echo "Beginning Alpine rsync..." | |
| #src=rsync://plug-mirror.rcac.purdue.edu/alpine/ | |
| src=rsync://mirror.math.princeton.edu/pub/alpinelinux/ | |
| dest=/srv/alpine/ | |
| # keep out old versions -- here, excluding v3.0 through v3.21 | |
| # also keep out architectures we don't use | |
| excludes='/.htaccess /edge /v3.[0-9] /v3.1[0-9] /v3.2[0-1] loongarch64/ armhf/ armv7/ s390x/ ppc64le/ riscv64/ x86/' | |
| rsync_opts="--stats --recursive --links --hard-links --times --delay-updates --delete --delete-after --log-file=rsync.log ${rsync_opts:-}" | |
| for path in $excludes; do | |
| rsync_opts="$rsync_opts --exclude=$path" | |
| done | |
| rsync $rsync_opts --exclude .update-repo.sh --exclude rsync.log $src $dest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment