Commit 3278adf1 authored by Andrey Kumanyaev's avatar Andrey Kumanyaev

simple DRY (if non-usual installation)

parent 58231f31
#!/bin/bash
src="/home/git/repositories"
home_dir="/home/git"
src="$home_dir/repositories"
for dir in `ls "$src/"`
do
......@@ -14,22 +15,22 @@ do
if [[ "$dir" =~ ^.*\.git$ ]]
then
project_hook="$src/$dir/hooks/post-receive"
gitolite_hook="/home/git/gitlab-shell/hooks/post-receive"
gitolite_hook="$home_dir/gitlab-shell/hooks/post-receive"
ln -s -f $gitolite_hook $project_hook
project_hook="$src/$dir/hooks/update"
gitolite_hook="/home/git/gitlab-shell/hooks/update"
gitolite_hook="$home_dir/gitlab-shell/hooks/update"
ln -s -f $gitolite_hook $project_hook
else
for subdir in `ls "$src/$dir/"`
do
if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*\.git$ ]]; then
project_hook="$src/$dir/$subdir/hooks/post-receive"
gitolite_hook="/home/git/gitlab-shell/hooks/post-receive"
gitolite_hook="$home_dir/gitlab-shell/hooks/post-receive"
ln -s -f $gitolite_hook $project_hook
project_hook="$src/$dir/$subdir/hooks/update"
gitolite_hook="/home/git/gitlab-shell/hooks/update"
gitolite_hook="$home_dir/gitlab-shell/hooks/update"
ln -s -f $gitolite_hook $project_hook
fi
done
......
#!/bin/bash
home_dir="/home/git"
echo "Danger!!! Data Loss"
while true; do
read -p "Do you wish to delete all directories (except gitolite-admin.git) from /home/git/repositories/ (y/n) ?: " yn
read -p "Do you wish to delete all directories (except gitolite-admin.git) from $home_dir/repositories/ (y/n) ?: " yn
case $yn in
[Yy]* ) sh -c "find /home/git/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs sudo rm -rf"; break;;
[Yy]* ) sh -c "find $home_dir/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs sudo rm -rf"; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
......
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