summaryrefslogtreecommitdiff
path: root/bin/install
blob: 64ae726fd2975288cce2a761420477456a45b4f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env ruby

require_relative '../lib/gitlab_init'

#
# GitLab shell, invoked from ~/.ssh/authorized_keys
#

config = GitlabConfig.new
key_dir = File.dirname("#{config.auth_file}")

commands = [
  %W(mkdir -p #{config.repos_path}),
  %W(mkdir -p #{key_dir}),
  %W(chmod 700 #{key_dir}),
  %W(touch #{config.auth_file}),
  %W(chmod 600 #{config.auth_file}),
  %W(chmod -R ug+rwX,o-rwx #{config.repos_path}),
  %W(find #{config.repos_path} -type d -exec chmod g+s {} ;)
]

commands.each do |cmd|
  print "#{cmd.join(' ')}: "
  if system(*cmd)
    puts 'OK'
  else
    puts 'Failed'
    abort "#{$PROGRAM_NAME} failed"
  end
end

exit