Commit f457f974 authored by Jaakko Kantojärvi's avatar Jaakko Kantojärvi

Remove hard coded home

Also wrote shell script in shell...
parent 2c238b71
...@@ -3,25 +3,19 @@ ...@@ -3,25 +3,19 @@
# $1 is an optional argument specifying the location of the repositories directory. # $1 is an optional argument specifying the location of the repositories directory.
# Defaults to /home/git/repositories if not provided # Defaults to /home/git/repositories if not provided
home_dir="/home/git" src=${1:-"$HOME/repositories"}
src=${1:-"$home_dir/repositories"}
function create_link_in { function create_link_in {
ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update" ln -s -f "$HOME/gitlab-shell/hooks/update" "$1/hooks/update"
} }
for dir in `ls "$src/"` for dir in "$src/"*; do
do if [ -d "$dir" ]; then
if [ -d "$src/$dir" ]; then if [ "$dir" != "${dir%.git}" ]; then
if [[ "$dir" =~ ^.*\.git$ ]] create_link_in "$dir"
then
create_link_in "$src/$dir"
else else
for subdir in `ls "$src/$dir/"` for subdir in "$dir/"*.git; do
do create_link_in "$subdir"
if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then
create_link_in "$src/$dir/$subdir"
fi
done done
fi fi
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment