summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-07 22:38:21 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-07 22:38:21 -0800
commit87e2d6e98a004bd3535bb2379d24309181128f57 (patch)
treecfb0e18686442445e3eec0d2c8dbc6c28805d6e5
parent491d3cee86fa6e7a544443c1400d60ecfc1451f7 (diff)
parent3278adf1e76be62dcc1dd509cff309b297b807c0 (diff)
downloadgitlab-shell-87e2d6e98a004bd3535bb2379d24309181128f57.tar.gz
Merge pull request #5 from zzet/feature/fix_install_script
Simple changes in commands
-rwxr-xr-xbin/install13
-rwxr-xr-xsupport/rewrite-hooks.sh11
-rwxr-xr-xsupport/truncate_repositories.sh6
3 files changed, 18 insertions, 12 deletions
diff --git a/bin/install b/bin/install
index f6b0974..d7cb257 100755
--- a/bin/install
+++ b/bin/install
@@ -6,12 +6,15 @@ require_relative '../lib/gitlab_init'
# GitLab shell, invoked from ~/.ssh/authorized_keys
#
+config = GitlabConfig.new
+key_dir = config.auth_file.delete "authorized_keys"
+
commands = [
- "mkdir -p /home/git/repositories",
- "mkdir -p /home/git/.ssh",
- "touch /home/git/.ssh/authorized_keys",
- "chmod -R ug+rwX,o-rwx /home/git/repositories/",
- "find /home/git/repositories -type d -print0 | xargs -0 chmod g+s"
+ "mkdir -p #{config.repos_path}",
+ "mkdir -p #{key_dir}",
+ "touch #{config.auth_file}",
+ "chmod -R ug+rwX,o-rwx #{config.repos_path}",
+ "find #{config.repos_path} -type d -print0 | xargs -0 chmod g+s"
]
commands.each do |cmd|
diff --git a/support/rewrite-hooks.sh b/support/rewrite-hooks.sh
index b328f3e..6de4dfc 100755
--- a/support/rewrite-hooks.sh
+++ b/support/rewrite-hooks.sh
@@ -1,6 +1,7 @@
#!/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
diff --git a/support/truncate_repositories.sh b/support/truncate_repositories.sh
index 69402d9..3711d6e 100755
--- a/support/truncate_repositories.sh
+++ b/support/truncate_repositories.sh
@@ -1,10 +1,12 @@
#!/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