diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-28 19:21:56 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-10-28 19:21:56 +0200 |
commit | cc193ea45d8d0651fe09fc93bb1417eaac50c2ff (patch) | |
tree | a4597234df0744697be22fd647742f79358d3317 /support | |
parent | ff33e05bbe94bce3184fbbe7bb63cc4a4a511668 (diff) | |
parent | 3b77882e02da5702754bd2a23bca17a6a7d83a07 (diff) | |
download | gitlab-shell-cc193ea45d8d0651fe09fc93bb1417eaac50c2ff.tar.gz |
Merge pull request #90 from Razer6/optional_repo_path
Add optional repo path, remove reference to gitolite repo
Diffstat (limited to 'support')
-rwxr-xr-x | support/truncate_repositories.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/support/truncate_repositories.sh b/support/truncate_repositories.sh index 66ff972..754d273 100755 --- a/support/truncate_repositories.sh +++ b/support/truncate_repositories.sh @@ -1,12 +1,17 @@ #!/bin/bash -home_dir="/home/git" +# $1 is an optional argument specifying the location of the repositories directory. +# Defaults to /home/git/repositories if not provided + + +home_dir="/home/git/repositories" +src=${1:-"$home_dir"} 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 from $home_dir/ (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 $home_dir/. -maxdepth 1 -not -name '.' | xargs rm -rf"; break;; [Nn]* ) exit;; * ) echo "Please answer yes or no.";; esac |