gitlab;shell init script
This commit is contained in:
parent
8ae1d812dc
commit
cdcf69d0d9
2 changed files with 33 additions and 1 deletions
|
@ -51,7 +51,7 @@ Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
|
||||||
Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
|
Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
|
||||||
Settings.gitlab['support_email'] ||= Settings.gitlab.email_from
|
Settings.gitlab['support_email'] ||= Settings.gitlab.email_from
|
||||||
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
|
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
|
||||||
Settings.gitlab['user'] ||= 'gitlab'
|
Settings.gitlab['user'] ||= 'git'
|
||||||
Settings.gitlab['signup_enabled'] ||= false
|
Settings.gitlab['signup_enabled'] ||= false
|
||||||
|
|
||||||
Settings['gravatar'] ||= Settingslogic.new({})
|
Settings['gravatar'] ||= Settingslogic.new({})
|
||||||
|
|
32
lib/tasks/gitlab/shell.rake
Normal file
32
lib/tasks/gitlab/shell.rake
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
namespace :gitlab do
|
||||||
|
namespace :shell do
|
||||||
|
desc "GITLAB | Setup gitlab-shell"
|
||||||
|
task :setup => :environment do
|
||||||
|
setup
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def setup
|
||||||
|
warn_user_is_not_gitlab
|
||||||
|
|
||||||
|
puts "This will rebuild an authorized_keys file."
|
||||||
|
puts "You will lose any data stored in /home/git/.ssh/authorized_keys."
|
||||||
|
ask_to_continue
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
system("echo '# Managed by gitlab-shell' > /home/git/.ssh/authorized_keys")
|
||||||
|
|
||||||
|
Key.find_each(:batch_size => 1000) do |key|
|
||||||
|
if Gitlab::Shell.new.add_key(key.shell_id, key.key)
|
||||||
|
print '.'
|
||||||
|
else
|
||||||
|
print 'F'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rescue Gitlab::TaskAbortedByUserError
|
||||||
|
puts "Quitting...".red
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue