blob: 0813b1c1f8a7f9ac37f656e4c1fe05064aaf94dc (
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
|
#!/bin/bash
# $1 is an optional argument specifying the location of the repositories directory.
# Defaults to /home/git/repositories if not provided
home_dir="/home/git"
src=${1:-"$home_dir/repositories"}
function create_links_in {
for gitlab_shell_hooks in ${home_dir}/gitlab-shell/hooks/* ; do
ln -s -f "$gitlab_shell_hooks" "$1/hooks/"
done
}
for dir in `ls "$src/"`
do
if [ -d "$src/$dir" ]; then
if [[ "$dir" =~ ^.*\.git$ ]]
then
create_links_in "$src/$dir"
else
for subdir in `ls "$src/$dir/"`
do
if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then
create_links_in "$src/$dir/$subdir"
fi
done
fi
fi
done
|