39 lines
1.7 KiB
Diff
39 lines
1.7 KiB
Diff
--- a/support/rewrite-hooks.sh 2013-08-26 11:59:22.000000000 +0200
|
|
+++ b/support/rewrite-hooks.sh 2013-09-10 21:31:30.135841009 +0200
|
|
@@ -1,13 +1,14 @@
|
|
#!/bin/bash
|
|
|
|
# $1 is an optional argument specifying the location of the repositories directory.
|
|
-# Defaults to /home/git/repositories if not provided
|
|
+# If no argument is provided then path is readed from /etc/gitlab-shell.yml
|
|
|
|
-home_dir="/home/git"
|
|
-src=${1:-"$home_dir/repositories"}
|
|
+base_path="$(realpath `dirname $(readlink -f "$0")`/..)"
|
|
+repos_path="$(ruby -ryaml -e 'puts YAML::load_file("/etc/gitlab-shell.yml")["repos_path"]')"
|
|
+src=${1:-"$repos_path"}
|
|
|
|
function create_link_in {
|
|
- ln -s -f "$home_dir/gitlab-shell/hooks/update" "$1/hooks/update"
|
|
+ ln -s -f "$base_path/hooks/update" "$1/hooks/update"
|
|
}
|
|
|
|
for dir in `ls "$src/"`
|
|
--- a/support/truncate_repositories.sh 2013-08-26 11:59:22.000000000 +0200
|
|
+++ b/support/truncate_repositories.sh 2013-09-10 21:31:30.135841009 +0200
|
|
@@ -1,12 +1,12 @@
|
|
#!/bin/bash
|
|
|
|
-home_dir="/home/git"
|
|
+repos_path="$(ruby -ryaml -e 'puts YAML::load_file("/etc/gitlab-shell.yml")["repos_path"]')"
|
|
|
|
echo "Danger!!! Data Loss"
|
|
while true; do
|
|
- read -p "Do you wish to delete all directories (except gitolite-admin.git) from $home_dir/repositories/ (y/n) ?: " yn
|
|
+ read -p "Do you wish to delete all directories (except gitolite-admin.git) from $repos_path (y/n) ?: " yn
|
|
case $yn in
|
|
- [Yy]* ) sh -c "find $home_dir/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs rm -rf"; break;;
|
|
+ [Yy]* ) sh -c "find $repos_path/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs rm -rf"; break;;
|
|
[Nn]* ) exit;;
|
|
* ) echo "Please answer yes or no.";;
|
|
esac
|