Commit c81d4ab4a9101620e06cb401e7267789a6376d36

Authored by LeonB
1 parent 04b2864b

Fixed some hardcoded paths

New config option: git_hooks_path
config/initializers/1_settings.rb
@@ -66,6 +66,10 @@ class Settings < Settingslogic @@ -66,6 +66,10 @@ class Settings < Settingslogic
66 git_host['base_path'] || '/home/git/repositories/' 66 git_host['base_path'] || '/home/git/repositories/'
67 end 67 end
68 68
  69 + def git_hooks_path
  70 + git_host['hooks_path'] || '/home/git/share/gitolite/hooks/'
  71 + end
  72 +
69 def git_upload_pack 73 def git_upload_pack
70 if git_host['upload_pack'] != false 74 if git_host['upload_pack'] != false
71 true 75 true
lib/tasks/gitlab/backup.rake
@@ -145,6 +145,7 @@ namespace :gitlab do @@ -145,6 +145,7 @@ namespace :gitlab do
145 permission_commands = [ 145 permission_commands = [
146 "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}", 146 "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}",
147 "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}", 147 "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}",
  148 + "sudo chown gitlab:gitlab #{Gitlab.config.git_base_path}**/hooks/post-receive"
148 ] 149 ]
149 permission_commands.each { |command| Kernel.system(command) } 150 permission_commands.each { |command| Kernel.system(command) }
150 puts "[DONE]".green 151 puts "[DONE]".green
lib/tasks/gitlab/status.rake
@@ -56,7 +56,7 @@ namespace :gitlab do @@ -56,7 +56,7 @@ namespace :gitlab do
56 return 56 return
57 end 57 end
58 58
59 - gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") 59 + gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
60 gitlab_hook_files = ['post-receive'] 60 gitlab_hook_files = ['post-receive']
61 gitlab_hook_files.each do |file_name| 61 gitlab_hook_files.each do |file_name|
62 dest = File.join(gitolite_hooks_path, file_name) 62 dest = File.join(gitolite_hooks_path, file_name)
lib/tasks/gitlab/write_hook.rake
@@ -2,7 +2,7 @@ namespace :gitlab do @@ -2,7 +2,7 @@ namespace :gitlab do
2 namespace :gitolite do 2 namespace :gitolite do
3 desc "GITLAB | Write GITLAB hook for gitolite" 3 desc "GITLAB | Write GITLAB hook for gitolite"
4 task :write_hooks => :environment do 4 task :write_hooks => :environment do
5 - gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") 5 + gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
6 gitlab_hooks_path = Rails.root.join("lib", "hooks") 6 gitlab_hooks_path = Rails.root.join("lib", "hooks")
7 7
8 gitlab_hook_files = ['post-receive'] 8 gitlab_hook_files = ['post-receive']