#!/usr/bin/env bash
# Full Arch package mirror sync (Tier-2). rsync runs in the mirror-rsync container (no host rsync needed).
set -uo pipefail
SRC="$(cat /home/lili/mirror/.arch_src)"
LOG=/home/lili/mirror/logs/arch.log
echo "=== arch sync start $(date -u) src=$SRC ===" >>"$LOG"
docker run --rm --user 1000:1000 -v /home/lili/mirror:/mirror mirror-rsync \
  rsync -rtlH --safe-links --delete-after --delay-updates \
        --timeout=600 --contimeout=60 --stats \
        "$SRC" /mirror/archlinux/ >>"$LOG" 2>&1
echo "=== arch sync done $(date -u) rc=$? ===" >>"$LOG"
