Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-07 12:06:39 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-07 12:06:39 +0400
commitcdcf69d0d9c06bbaf6a6ba25793985fe02dd1092 (patch)
tree25ef87788a71b552f5f3e97efcdd8a80d403c8a1 /lib
parent8ae1d812dc9c8099b691e164e7119ede7eb21c61 (diff)
gitlab;shell init script
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/gitlab/shell.rake32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
new file mode 100644
index 00000000000..25713482ed8
--- /dev/null
+++ b/lib/tasks/gitlab/shell.rake
@@ -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
+