summaryrefslogtreecommitdiff
path: root/clone-repos
blob: 6991380a2ccfceccda68cb21c5acebb492380ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

base_dir=$(dirname "$(readlink -f "$0")")

if [ ! -s "${base_dir}/work/wish-list" ]; then
  exit
fi

while read -r source_base64; do
  if [ -d "${base_dir}/work/repositories/${source_base64}" ]; then
    continue
  fi
  source=$(
    printf '%s' "${source_base64}" | \
      base64 -d
  )
  git -C "${base_dir}/work/repositories" clone --mirror "${source}" "${source_base64}"
done < \
  "${base_dir}/work/wish-list"

grep -vxF "$(ls "${base_dir}/work/repositories")" "${base_dir}/work/wish-list" | \
  sponge "${base_dir}/work/wish-list"