Skip to content

Instantly share code, notes, and snippets.

@bigeagle
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigeagle/a0bfc792edc03af6d44e to your computer and use it in GitHub Desktop.
Save bigeagle/a0bfc792edc03af6d44e to your computer and use it in GitHub Desktop.
#!/bin/bash
ARCH_UPSTREAM="mirrors6.ustc.edu.cn"
LOCK="/tmp/arch-mirror.lck"
(
# Wait for lock on /var/lock/.myscript.exclusivelock (fd 200) for 10 seconds
flock -x -w 10 200 || exit 1
rsync -6 -aHv --delete-after rsync://${ARCH_UPSTREAM}/archlinux/ /mnt/sdb1/mirror/archlinux/current/ &> /tmp/rsync.log
echo "$(date --rfc-3339=seconds)" >> /tmp/rsync.log
echo "$(date --rfc-3339=seconds)" >> /tmp/archlinuxarm.log
exit 0
) 200>$LOCK
core/
atomic/
development/
extras/
SRPM/
SRPMS/
source/
debug/
/releases/7/
/releases/8/
/releases/9/
/releases/10/
/releases/11/
/releases/12/
/releases/13/
/releases/14/
/releases/15/
/releases/16/
/releases/17/
/releases/18/
/releases/19/
/releases/test/
/updates/9/
/updates/10/
/updates/11/
/updates/12/
/updates/13/
/updates/14/
/updates/15/
/updates/16/
/updates/17/
/updates/18/
/updates/19/
/updates/testing/
#!/usr/bin/env python
ARCH_EXCLUDE = ['armel', 'arm64', 'alpha', 'hurd-i386', 'ia64', 'kfreebsd-amd64', 'kfreebsd-i386', 'mips', 'mipsel', 'powerpc', 'ppc64el', 's390', 's390x', 'sparc']
CONTENT_EXCLUDE = ['binary-{arch}', 'installer-{arch}', 'Contents-{arch}.gz', 'Contents-udeb-{arch}.gz', 'Contents-{arch}.diff', 'arch-{arch}.files', 'arch-{arch}.list.gz', '*_{arch}.deb', '*_{arch}.udeb', '*_{arch}.changes']
with open("debian-exclude.txt", 'wb') as f:
for arch in ARCH_EXCLUDE:
for content in CONTENT_EXCLUDE:
f.write(content.format(arch=arch))
f.write('\n')
# rsync -aHv --delete-after --exclude-from debian-exclude.txt rsync://mirrors.ustc.edu.cn/ /path/to/mirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment