blob: 89dcb24d1a219a83b6ea8b5c0640b28216be5aa1 (
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
25
26
27
28
29
30
31
32
33
|
#!/bin/sh
base_dir=$(dirname "$(readlink -f "$0")")
if [ ! -s "${base_dir}/work/wish-list" ]; then
exit
fi
while read -r type source_base64; do
if [ -d "${base_dir}/work/repositories/${source_base64}" ]; then
continue
fi
source=$(
printf '%s' "${source_base64}" | \
base64 -d
)
case "${type}" in
'git')
git -C "${base_dir}/work/repositories" clone --mirror "${source}" "${source_base64}"
;;
*)
>&2 printf 'unknown type "%s"\n' \
"${type}"
;;
)
done < \
"${base_dir}/work/wish-list"
grep -vxF "$(
find "${base_dir}/work/repositories" -mindepth 2 -maxdepth 2 | \
sed 's,^.*/\([^/]\+\)/\([^/]\+\)$,\1 \2,'
)" "${base_dir}/work/wish-list" | \
sponge "${base_dir}/work/wish-list"
|