Skip to content

Instantly share code, notes, and snippets.

@Eskuero
Created August 26, 2019 23:34
Show Gist options
  • Save Eskuero/21db2b49df3d8ede5cf038fe34044952 to your computer and use it in GitHub Desktop.
Save Eskuero/21db2b49df3d8ede5cf038fe34044952 to your computer and use it in GitHub Desktop.
Script to exclusively sync "x86_64" arch and "latest-stable" tag from an Alpine Linux mirror into a local folder.
#!/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
src=rsync://rsync.alpinelinux.org/alpine/
dest=/var/lib/libvirt/filesystems/common/mirror
mkdir -p "$dest"
/usr/bin/rsync \
--archive \
--copy-links \
--info=progress2 \
--delete \
--exclude "v2.*" \
--exclude "v3.*" \
--exclude "edge" \
--exclude "latest-stable/community/aarch64" \
--exclude "latest-stable/community/armhf" \
--exclude "latest-stable/community/armv7" \
--exclude "latest-stable/community/ppc64le" \
--exclude "latest-stable/community/s390x" \
--exclude "latest-stable/community/x86" \
--exclude "latest-stable/main/aarch64" \
--exclude "latest-stable/main/armhf" \
--exclude "latest-stable/main/armv7" \
--exclude "latest-stable/main/ppc64le" \
--exclude "latest-stable/main/s390x" \
--exclude "latest-stable/main/x86" \
--exclude "latest-stable/releases" \
"$src" \
"$dest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment