Commit eea43c9412fcf1ce8de0230524114b2d643a0e0e

Authored by Riyad Preukschas
2 parents 9bc829d3 471b5910

Merge branch 'check_gitlab_in_git_group' of https://github.com/VonC/gitlabhq int…

…o VonC-check_gitlab_in_git_group
config/gitlab.yml.example
... ... @@ -29,6 +29,9 @@ gitlab:
29 29 ## Project settings
30 30 default_projects_limit: 10
31 31  
  32 + ## Account used for GitLab installation ('gitlab' if undefined)
  33 + user: gitlab
  34 +
32 35 ## Gravatar
33 36 gravatar:
34 37 enabled: true # Use user avatar images from Gravatar.com (default: true)
... ... @@ -104,6 +107,7 @@ gitolite:
104 107 receive_pack: true
105 108 ssh_user: git
106 109 ssh_host: localhost
  110 + group: git # default: 'git' if undefined
107 111 # ssh_port: 22
108 112 # config_file: gitolite.conf
109 113  
... ...
config/initializers/1_settings.rb
... ... @@ -50,6 +50,7 @@ Settings.gitlab['relative_url_root'] ||= ''
50 50 Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
51 51 Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
52 52 Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
  53 +Settings.gitlab['user'] ||= 'gitlab'
53 54  
54 55 Settings['gravatar'] ||= Settingslogic.new({})
55 56 Settings.gravatar['enabled'] ||= true
... ... @@ -67,6 +68,7 @@ Settings.gitolite['upload_pack'] ||= (Settings.gitolite['upload_pack'] != false
67 68 Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
68 69 Settings.gitolite['ssh_port'] ||= 22
69 70 Settings.gitolite['ssh_user'] ||= 'git'
  71 +Settings.gitolite['group'] ||= 'git'
70 72 Settings.gitolite['ssh_path_prefix'] ||= Settings.send(:build_gitolite_ssh_path_prefix)
71 73  
72 74 Settings['backup'] ||= Settingslogic.new({})
... ...
lib/tasks/gitlab/check.rake
... ... @@ -295,15 +295,16 @@ namespace :gitlab do
295 295 end
296 296  
297 297 def check_gitlab_in_git_group
298   - gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
299   - print "gitlab user is in #{gitolite_ssh_user} group? ... "
  298 + gitlab_user = Gitlab.config.gitlab.user
  299 + gitolite_group = Gitlab.config.gitolite.group
  300 + print "gitlab user '#{gitlab_user}' has git group '#{gitolite_group}'? ... "
300 301  
301   - if run_and_match("id -rnG", /\Wgit\W/)
  302 + if run_and_match("id -rnG", /^#{gitolite_group}\W|\W#{gitolite_group}\W|\W#{gitolite_group}$/)
302 303 puts "yes".green
303 304 else
304 305 puts "no".red
305 306 try_fixing_it(
306   - "sudo usermod -a -G #{gitolite_ssh_user} gitlab"
  307 + "sudo usermod -a -G #{gitolite_group} #{gitlab_user}"
307 308 )
308 309 for_more_information(
309 310 see_installation_guide_section "System Users"
... ...