summaryrefslogtreecommitdiff
path: root/bin/clone-mirror
blob: 78c98d96eb35f3bc8353d4490d8fe225dc13ed66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

work_dir=$(readlink -e "$0")
work_dir="${work_dir%/*/*}/work"

mkdir -p "${work_dir}/sticks/"

for stick_dir in "${work_dir}/sticks/"*; do
  [ -d "${stick_dir}" ] || continue
  mountpoint -q "${stick_dir}" || continue
  mkdir "${stick_dir}/archlinuxarm"
  rsync -rlptH --safe-links --delete-delay --delay-updates \
    $(
      for s in "${work_dir}/sticks/"*"/archlinuxarm"; do
        [ "${s}" = "${stick_dir}/archlinuxarm" ] || echo --copy-dest="${s}"
      done
    ) \
    'rsync://de3.mirror.archlinuxarm.org/archlinux-arm/' \
    "${stick_dir}/archlinuxarm"
done