Commit c81d4ab4 authored by LeonB's avatar LeonB

Fixed some hardcoded paths

New config option: git_hooks_path
parent 04b2864b
...@@ -66,6 +66,10 @@ class Settings < Settingslogic ...@@ -66,6 +66,10 @@ class Settings < Settingslogic
git_host['base_path'] || '/home/git/repositories/' git_host['base_path'] || '/home/git/repositories/'
end end
def git_hooks_path
git_host['hooks_path'] || '/home/git/share/gitolite/hooks/'
end
def git_upload_pack def git_upload_pack
if git_host['upload_pack'] != false if git_host['upload_pack'] != false
true true
......
...@@ -145,6 +145,7 @@ namespace :gitlab do ...@@ -145,6 +145,7 @@ namespace :gitlab do
permission_commands = [ permission_commands = [
"sudo chmod -R g+rwX #{Gitlab.config.git_base_path}", "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}",
"sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}", "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}",
"sudo chown gitlab:gitlab #{Gitlab.config.git_base_path}**/hooks/post-receive"
] ]
permission_commands.each { |command| Kernel.system(command) } permission_commands.each { |command| Kernel.system(command) }
puts "[DONE]".green puts "[DONE]".green
......
...@@ -56,7 +56,7 @@ namespace :gitlab do ...@@ -56,7 +56,7 @@ namespace :gitlab do
return return
end end
gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
gitlab_hook_files = ['post-receive'] gitlab_hook_files = ['post-receive']
gitlab_hook_files.each do |file_name| gitlab_hook_files.each do |file_name|
dest = File.join(gitolite_hooks_path, file_name) dest = File.join(gitolite_hooks_path, file_name)
......
...@@ -2,7 +2,7 @@ namespace :gitlab do ...@@ -2,7 +2,7 @@ namespace :gitlab do
namespace :gitolite do namespace :gitolite do
desc "GITLAB | Write GITLAB hook for gitolite" desc "GITLAB | Write GITLAB hook for gitolite"
task :write_hooks => :environment do task :write_hooks => :environment do
gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
gitlab_hooks_path = Rails.root.join("lib", "hooks") gitlab_hooks_path = Rails.root.join("lib", "hooks")
gitlab_hook_files = ['post-receive'] gitlab_hook_files = ['post-receive']
......
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