summaryrefslogtreecommitdiff
path: root/archmirror-repos.sh
blob: f15504a626e7d5c4e5cc0a6c339bf8ba3d94d9b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# /usr/local/sbin/archmirror-repos.sh
set -euo pipefail
UPSTREAM="rsync://mirror.csclub.uwaterloo.ca/archlinux/"
STAGE="/brimstone3/mirror-stage/arch-repos"
LIVE="/brimstone1/mirror/archlinux"
LOG="/var/log/mirrors/arch-repos.log"

mkdir -p "$STAGE" "$LIVE"

rsync -rtlH --safe-links --delete-delay --delay-updates \
  --exclude iso/ --exclude other/ \
  "$UPSTREAM" "$STAGE" | tee -a "$LOG"

rsync -rtlH --safe-links --delete-delay --delay-updates \
  --exclude iso/ --exclude other/ \
  "$UPSTREAM" "$STAGE" | tee -a "$LOG"

curl -fsS https://geo.mirror.pkgbuild.com/lastsync > "$LIVE/lastsync" \
  || date -u +%s > "$LIVE/lastsync"

ln -sfn "$STAGE" "$LIVE"
date -u +%s > "$LIVE/lastsync"