Skip to content

Instantly share code, notes, and snippets.

@perfectfoolish
Created August 23, 2013 07:57
Show Gist options
  • Save perfectfoolish/6316662 to your computer and use it in GitHub Desktop.
Save perfectfoolish/6316662 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
## for mac
#/Users/git/.rvm/rubies/ruby-1.9.3-p385/bin/ruby
require_relative '../lib/gitlab_init'
#
# GitLab shell, invoked from ~/.ssh/authorized_keys
#
config = GitlabConfig.new
key_dir = File.dirname("#{config.auth_file}")
commands = [
"mkdir -p #{config.repos_path}",
"mkdir -p #{key_dir}",
"touch #{config.auth_file}",
"chmod -R ug+rwX,o-rwx #{config.repos_path}",
"chmod 700 #{key_dir}",
"chmod 600 #{config.auth_file}",
"find #{config.repos_path} -type d -print0 | xargs -0 chmod g+s"
]
commands.each do |cmd|
puts "#{cmd}: #{system(cmd)}"
end
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment