blob: 2a0aa41caa48aacb42c6e14cfeddf0875e340564 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/bash
if [ $# -eq 0 ]; then
srcDir=$(
readlink -e "${HOME}/packageSources"
)
[ -d "${srcDir}" ] || exit 0
lockFile="${srcDir}/.lock"
if [ -s "${lockFile}" ] && kill -0 "$(cat "${lockFile}")"; then
exit
fi
echo $$ >"${lockFile}"
find "${srcDir}" \
-type d \
-exec sh -c 'test -f "{}/HEAD"' \; \
-printf 'git: %p\n' \
-prune , \
-type d \
-exec sh -c 'test -d "{}/.svn"' \; \
-printf 'svn: %p\n' \
-prune \
| parallel -j 0 -l 1 "$0"
rm -f "${lockFile}"
elif [ $# -eq 1 ]; then
case "${1%%: *}" in
'git')
git -C "${1#*: }" fetch --all -p \
|| rm -rf --one-file-system "${1#*: }"
;;
'svn')
cd "${1#*: }"
svn update \
|| rm -rf --one-file-system "${1#*: }"
;;
*)
>&2 printf '%s: unknown VCS "%s"\n' "$0" "${1%%: *}"
exit 1
;;
esac
else
>&2 printf '%s: too many arguments\n' "$0"
exit 1
fi
|