-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackup-gitolite
More file actions
executable file
·42 lines (34 loc) · 915 Bytes
/
backup-gitolite
File metadata and controls
executable file
·42 lines (34 loc) · 915 Bytes
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
#!/bin/sh
# Simon Walz, 2015
SCRIPTPATH="$(readlink -f 2>/dev/null || perl -MCwd -e 'print Cwd::abs_path shift' $0)"
SCRIPTDIR="$(dirname "${SCRIPTPATH}")"
GITOLITE_HOST="$1"
if test "x${GITOLITE_HOST}" = "x"
then
echo "Usage: $0 GITOLITE_HOST LOCAL_PATH_PREFIX [EXCLUDE_REPOS]"
exit 2
fi
PREFIX="$2"
EXCLUDE_REPOS="$3"
# get repos:
REPOS=`ssh "${GITOLITE_HOST}" info |grep -E "^ " | sed -e 's/^ [ #][ C] [ #][ R][ _] [ #][ W][ _]//g' | tr -d '\r'`
for r in $REPOS
do
rl=`echo "${r}" | sed -e 's/\//_/g'`
ignore=0
if test "x${EXCLUDE_REPOS}" != "x"; then
echo "${r}" | grep -E "${EXCLUDE_REPOS}" >/dev/null
if test "x$?" = "x0"; then
echo "# ignore repo: ${r}"
ignore=1
fi
fi
# ignore wild card repo entry
if echo "${r}" | grep -E "\[|@" >/dev/null
then
ignore=1
fi
if test "x$ignore" != "x1"; then
"${SCRIPTDIR}/backup-git-repo" "${GITOLITE_HOST}:${r}" "${PREFIX}${rl}"
fi
done