blob: bfb0a2f575c3616486f9128d2756d31b9507e71f (
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
34
35
36
37
38
39
|
#!/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')
mkdir -p "${base_dir}/work/repositories/git"
git -C "${base_dir}/work/repositories/git" clone --mirror "${source}" "${source_base64}"
;;
'hg')
mkdir -p "${base_dir}/work/repositories/hg"
echo hg -y --cwd "${base_dir}/work/repositories/hg" clone "${source}" "${source_base64}"
hg -y --cwd "${base_dir}/work/repositories/hg" clone "${source}" "${source_base64}"
;;
*)
>&2 printf 'unknown type "%s"\n' \
"${type}"
;;
esac
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"
|