Commit cdcf69d0d9c06bbaf6a6ba25793985fe02dd1092
1 parent
8ae1d812
Exists in
master
and in
4 other branches
gitlab;shell init script
Showing
2 changed files
with
33 additions
and
1 deletions
Show diff stats
config/initializers/1_settings.rb
| @@ -51,7 +51,7 @@ Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" | @@ -51,7 +51,7 @@ Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" | ||
| 51 | Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" | 51 | Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" |
| 52 | Settings.gitlab['support_email'] ||= Settings.gitlab.email_from | 52 | Settings.gitlab['support_email'] ||= Settings.gitlab.email_from |
| 53 | Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) | 53 | Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) |
| 54 | -Settings.gitlab['user'] ||= 'gitlab' | 54 | +Settings.gitlab['user'] ||= 'git' |
| 55 | Settings.gitlab['signup_enabled'] ||= false | 55 | Settings.gitlab['signup_enabled'] ||= false |
| 56 | 56 | ||
| 57 | Settings['gravatar'] ||= Settingslogic.new({}) | 57 | Settings['gravatar'] ||= Settingslogic.new({}) |
| @@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
| 1 | +namespace :gitlab do | ||
| 2 | + namespace :shell do | ||
| 3 | + desc "GITLAB | Setup gitlab-shell" | ||
| 4 | + task :setup => :environment do | ||
| 5 | + setup | ||
| 6 | + end | ||
| 7 | + end | ||
| 8 | + | ||
| 9 | + def setup | ||
| 10 | + warn_user_is_not_gitlab | ||
| 11 | + | ||
| 12 | + puts "This will rebuild an authorized_keys file." | ||
| 13 | + puts "You will lose any data stored in /home/git/.ssh/authorized_keys." | ||
| 14 | + ask_to_continue | ||
| 15 | + puts "" | ||
| 16 | + | ||
| 17 | + system("echo '# Managed by gitlab-shell' > /home/git/.ssh/authorized_keys") | ||
| 18 | + | ||
| 19 | + Key.find_each(:batch_size => 1000) do |key| | ||
| 20 | + if Gitlab::Shell.new.add_key(key.shell_id, key.key) | ||
| 21 | + print '.' | ||
| 22 | + else | ||
| 23 | + print 'F' | ||
| 24 | + end | ||
| 25 | + end | ||
| 26 | + | ||
| 27 | + rescue Gitlab::TaskAbortedByUserError | ||
| 28 | + puts "Quitting...".red | ||
| 29 | + exit 1 | ||
| 30 | + end | ||
| 31 | +end | ||
| 32 | + |